-1

When I run the following:

self.driver.execute_script("document.getElementByXpath('//input[@id='someid']').value='someValue';

It gives an error

selenium.common.exceptions.JavascriptException: Message:
javascript error: missing ) after argument list
1
  • 1
    You missed a parenthesis after the semi-colon, and you have to change the single quote to double-quotes ("string" instead of 'string') in one of the places. Commented Jul 10, 2022 at 15:22

1 Answer 1

3

You are using the same kind of quote in two different levels of parsing, and so '//input[@id=' is interpreted as one string literal, after which someid is unexpected.

Change:

document.getElementByXpath('//input[@id='someid']')

To:

document.getElementByXpath('//input[@id=\"someid\"]')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.