-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
Michael Delgado
  • 13,789
  • 3
  • 29
  • 54
  • 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. – The Amateur Coder Jul 10 '22 at 15:22

1 Answers1

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\"]')
trincot
  • 317,000
  • 35
  • 244
  • 286