Issue: Error encountered while trying to use the removeAttribute() function in Selenium and Java: missing closing parenthesis after argument list

WebElement  removeReadOnly=driver.findElement(By.xpath("//input[@id='mat-input-0']"));

js.executeScript("document.getElementBypath('//input[@id='mat-input-0']').removeAttribute('readonly');","removeReadOnly");

Error: There is a JavaScript error of missing ) after the argument list.

Answer №1

The element datedelete has been successfully located as shown below:

WebElement datedelete = driver.findElement(By.xpath("//input[@id='mat-input-0']"));

All you have to do now is provide the WebElement as an argument:

((JavascriptExecutor)driver).executeScript("arguments[0].removeAttribute('readonly')", datedelete);

Additional Resources

For more in-depth discussions, refer to the following links:

  • Selenium Datepicker using JavascriptExecutor

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

Including JavaScript in HTML Error 404

https://i.stack.imgur.com/aQDPG.png I am struggling to understand why this import is not functioning as expected. I have tried using script/import.js but it still fails to work. The error message I keep receiving is: 127.0.0.1 - - [09/Sep/2020 15:09:35] ...

The JQuery AJAX Done function fails to execute

$('#loginForm').submit(function(e){ var $inputs = $(this).find("input"); var serializedData = $(this).serialize(); $inputs.prop("disabled", true); var request = $.ajax({ url: "myurl", d ...

Choosing a datepicker in Selenium can be easily done by identifying the date

Hello, I need help selecting a datepicker from an image. I am trying to select the date 27th March 2016. https://i.stack.imgur.com/OW80A.png Here is the code for the datepicker: <div id="widget_dijit_form_DateTextBox_6" class="dijit dijitReset dijitI ...

How can I transfer a MongoDB collection to an EJS file in the form of a sorted list?

I have successfully displayed the collection as a json object in its own route, but now I want to show the collection in a list under my index.ejs file (I'm still new to ejs and MongoDB). Below is the code that allows me to view the json object at lo ...

After 6 minutes of inactivity, queues are automatically deleted when the Android tablet enters standby mode

Once the client (also known as the browser) goes into sleep mode, it stops receiving new updates from the subscribed queue after about 6 minutes. Upon checking RabbitMQ Management, I noticed that the related queues (like stomp-subscription-MBSsZ9XB0XCScXbS ...

Having trouble bringing in components to my pages in ReactJS

There seems to be an issue preventing me from importing the components onto the page, resulting in this error: ERROR in ./src/pages/Home.jsx 4:0-37 Module not found: Error: Can't resolve './components/Card' in '/home/c4p1/blog/src/pages ...

When scrolling, dynamically change the background color by adding a class

I am looking to achieve a scroll effect where the color of the menu buttons changes. Perhaps by adding a class when scrolling and hitting the element? Each menu button and corresponding div has a unique ID. Can anyone suggest what JavaScript code I should ...

What is the best way to mix up the middle letters within certain positions of a word?

Here is what I have managed to achieve so far: mounted() { const randomVariants = [...Array(3)].map(() => this.baseWord .split('') .sort(() => 0.5 - Math.random()) .join('') ) const variantsWithoutIniti ...

Converting a JavaScript function to CoffeeScript, accepting jQuery's .map function and Selectors as parameters

I'm in the process of converting some JavaScript code into CoffeeScript and encountering an issue with a particular function. Here is the original functioning JS: $(".comformt_QA").change(function(){ var array = $(".comformt_QA").map(function() { ...

Experiencing difficulty accessing website using Selenium

My attempt to use Selenium to log into the Ingram Micro website is causing an issue, unlike other sites where my script works flawlessly. The error/message I encounter specifically is: selenium.common.exceptions.ElementClickInterceptedException: Message: ...

Is there a way to store my collection data in a variable and access it externally from the file?

Topic of Interest : Working with Discord.js I am seeking advice on how to save collector data in a variable and access it outside of the file, for example in index.js. I aim to create a setup command that prompts users with questions when they type -setup ...

Unable to pass multiple objects as props in Vue component causing issues

Seeking help on passing multiple props to a component using v-for: <my-component v-for="(item, index) in items"></my-component> The data structure 'items' consists of: items: { 1: { name: "Apple", color: "Red" }, 2: { name: "Ba ...

Validator alert for AMP scripts

I have implemented the amp version for my content management system. Since each article has a different body, some include amp-instagram while others include amp-facebook, and so on. In order to cover all bases, I have added both amp-facebook and amp-inst ...

Creating dynamic content in the Ajax-enabled Smart Admin theme: A step-by-step guide

As I work on developing an application for a client, my focus is on creating a web service using Laravel5 for the backend. To enhance the user interface of this web service, I have chosen to incorporate the Smart Admin Theme, specifically utilizing the Aja ...

Utilizing vue-router to create two separate navigation bars where only one link is highlighted as active

In my setup, I have implemented two sections with navigation structured as follows: <ul class="navigation-list"> <li v-for="(route, index) in navRoutes"> <router-link :to="route.path"> <span>{{ route.name }}</span> ...

Deciphering the intricate mechanics behind _.bind

This block of code is an excerpt from the Underscore library, specifically showcasing the implementation of the _.bind function. However, I am struggling to comprehend the purpose behind modifying the prototype of an empty function. var customConstruc ...

What is the best way to share models across different node.js projects?

In my setup, I have two node.js projects - project A and project B. Project A serves as the main project, while project B is more of an "ad-hoc" project with a specific purpose. The challenge lies in the fact that project B requires access to project A&apo ...

Having issues with my custom AngularJS directive functionality

app.directive("myData", function() { return { templateUrl: '/my-data.html' }; }); my-data.html file code <tr ng-repeat="employee in employees"> <td>{{employee.id}}</td> <td>{{employee.name}}</t ...

Plotting only the initial and final point on Google Maps using API

I am currently working on a tracking application that utilizes the Geolocation and Google Maps API. The app is set up to track the user's position using the watchPosition() function. As of now, a new blue icon is displayed every time a new longitude a ...

My eCommerce website is currently experiencing some technical difficulties that need to be addressed

I'm in need of assistance with a particular error I encountered. I was following an ecommerce example application and everything seemed to be going smoothly until I clicked on "Shop Now." At that point, I received the following message: Server Error T ...