vendredi 20 décembre 2019

Call for global variable in JS block of Selenium Webdriver test (Python)

I have a string of numbers set by user. Defined in the beginning of the Webdriver test:

numbers = input("prompt")

Then I need to enter value of this variable by JS code like this:

driver.execute_script("document.getElementsByName('phone')[0].value=***")

Where instead of *** I need the value of "numbers" variable. How should I properly insert it to make it work?

Aucun commentaire:

Enregistrer un commentaire