Having trouble populating a read-only text box nested within an iframe using the Watir WebDriver

Having trouble filling a read-only text field inside an iframe? Check out the navigation steps below.

  1. The URL is ""

  2. Click on the "Monthly Price" button.

  3. A text box will appear on overlay.

Having difficulty filling that text box? Here are some methods that were tried:

  1. b.iframe(:class => "lb_iframe_pricegrid").execute_script("window.document.getElementById('actionForm_moveindate').value = '03/20/2015';")

An error was encountered:

Selenium::WebDriver::Error::JavascriptError: window.document.getElementById(...) is null
  1. b.execute_script("window.document.getElementById('actionForm_moveindate').value = '03/20/2015';")

An error occurred:

Selenium::WebDriver::Error::JavascriptError: window.document.getElementById(...) is null
  1. b.iframe(:class => "lb_iframe_pricegrid").text_field.set "02/20/2015"

The following error is being faced:

Watir::Exception::ObjectReadOnlyException: object is read only {:tag_name=>"input or textarea", :type=>"(any text type)"}
    from /Library/Ruby/Gems/2.0.0/gems/watir-webdriver-0.6.10/lib/watir-webdriver/elements/element.rb:553:in `assert_writable'
    from /Library/Ruby/Gems/2.0.0/gems/watir-webdriver-0.6.10/lib/watir-webdriver/user_editable.rb:12:in `set'
    from (irb):19
    from /usr/bin/irb:12:in `<main>'

Any tips or suggestions to make it work?

Answer №1

This is how your code should appear:

b.execute_script("window.frames[0].document.getElementById('actionForm_moveindate').value = '03/20/2015';")

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Revealing/disguising elements based on user input changes

I'm currently focused on implementing dynamic search functionality. My goal is to have the #Main div hidden and the #search_list div displayed whenever I type in the input field with the id #search. Also, if I use the keyboard shortcut Ctrl+A & B ...

How can a tooltip be displayed on a disabled toggleButton?

When trying to display a tooltip for MUI's ToggleButton while it is disabled, I am encountering an issue where the tooltip works fine for enabled ToggleButtons but breaks for disabled ones. <ToggleButton value={item?.key} aria-label="left aligned" ...

What is the best way to extract a single value from my directive scope?

I am working with an AngularJS directive that has a non-isolated scope, but I have one variable, "isOpen," that needs to be isolated within the directive. Consider the following example: app.directive('myDir', function() { return { r ...

The <tbody> element remains visible even after changing the value in a dropdown menu

I have a table where I need to hide or show specific groups of rows based on the value selected in a dropdown menu. This page is built with a master page and here is the code for my dropdown box: $(function() { $("#ddlIncomeAssement").change(function() ...

ES6 syntax makes use of variables enclosed in curly braces

Could you explain the impact of the bracket followed by a braces combination (for example, ({user}) below)? promise1.then(user => ({user})); ...

When using Next.js and Express.js together, CORS error may occur, causing API queries to only function properly during build

I am currently working on a project that involves using Next.js for the front-end and Express.js for the back-end. Front-end Setup The 'pages' directory contains an 'index.js' file where I have implemented the following code snippet: ...

Ways to confirm an error message using Jest mock for throwing an error within a catch block

I'm having trouble mocking the catch block in jest for the code snippet throw Error(JSON.stringify(studentErrorRes));. While I can partially verify that an error is thrown, I'm unable to mock the error message properly. Typically, I use .mockReje ...

Adding hyperlinks to images on a Project Page in Squarespace with the help of JQuery

I'm currently creating a website on Squarespace and facing a challenge with the project pages. While Squarespace allows me to add images with titles and descriptions, I do not have direct access to edit the page. Unfortunately, the platform does not h ...

Creating a line between two points in raphael

Hello there, I'm looking to create a line between two points in Raphael. Could you please provide me with some examples or guidance on how to achieve this? Thanks a lot!) ...

Building a dynamic attribute management system with vue and vuetify

In the backend business object, there is a custom attributes data structure that allows clients to add key/value pairs for storing in the database. For instance: Map<String, String> customAttributes; Here's an example of how it would look in th ...

Once the project is already created, you can integrate SASS into Angular CLI

Currently, I'm working on an Angular 4 project that was built using the Angular CLI. I'm aware that you can specify SASS as the styling option when creating a project with the Angular CLI, like this: ng new ProjectName --style=sass Now, I&apos ...

Output a message to the Java console once my Selenium-created Javascript callback is triggered

My journey with Javascript has led me to mastering callback functions and grasping the concept of 'functional programming'. However, as a newcomer to the language, I struggle to test my syntax within my IntelliJ IDE. Specifically, I am working on ...

Having trouble locating the module 'monaco-editor/esm/vs/editor/editor.worker' while using create react app

I am currently facing some challenges running react-monaco-editor in my project despite following the documentation and making necessary adjustments to my files. Below is a snippet of my package.json file: { "name": "chatbot_compiler", "version": "0. ...

No content appears on the multi-form component in React

After several attempts at building a multi-step form in React, I initially created a convoluted version using React.Component with numerous condition tests to determine which form to display. Unsatisfied with this approach, I decided to refactor the code f ...

Exploring TypeScript: Understanding how to define Object types with variable properties names

Having an issue with a React + TypeScript challenge that isn't causing my app to crash, but I still want to resolve this lingering doubt! It's more of a query than a problem! My goal is to set the property names of an object dynamically using va ...

The Vuetify treeview displayed all objects as open, even though I had not enabled the "open-all" option

Currently, I am configuring Vuetify's treeview component for my project. When I clicked on the folder objects within the treeview, every object opened up without me setting the 'open-all' option. My project is based on vue cli 3 and my ESLi ...

Creating a tooltip for new list items: A step-by-step guide

I'm currently working on creating a tooltip using JQuery for incoming list items. Users will input text in a textfield, press enter, and those values will be displayed in a visible list on the website. I intend to have a tooltip associated with each i ...

Passing a JavaScript function as an argument

In the process of developing a JavaScript application, I am tasked with creating a handler that can accept a function as a parameter: Here is an example function: function myFunction() { alert("hello world"); } This is the handler implementation: func ...

What is the process for defining custom properties for RequestHandler in Express.js middleware functions?

In my express application, I have implemented an error handling middleware that handles errors as follows: export const errorMiddleware = (app: Application): void => { // If the route is not correct app.use(((req, res, next): void => { const ...

Here are some tips for retrieving information from a JavaScript object

My goal is to extract the values of free_time, done_ratio, criticalTask, and dependency from a JavaScript object for each task. I attempted to achieve this, but unfortunately, it didn't yield the desired results. var mock_data_allocation = {"alloc ...