-
-
Save xros/703066ac95d37596e0c1557e87c509a8 to your computer and use it in GitHub Desktop.
selenium set attribute - http://stackoverflow.com/questions/25583641/set-value-of-input-instead-of-sendkeys-selenium-webdriver-nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# retrieve webelement | |
input = driver.find_element_by_xpath("//*[@name='fieldname']") | |
# set attribute from js script referencing webelement found in python code | |
driver.execute_script("arguments[0].setAttribute('value', 'new value!')", input); | |
# or | |
driver.execute_script("arguments[0].setAttribute('value', arguments[1])", input, 'new value!'); | |
# Code for File Upload | |
file_input = driver.find_element_by_id("uploadBtn") | |
file_input.send_keys("/absolute/path/to/file") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment