I would like to write a Python script to automate a process. Therefore I need interact with a webinterface. I installed Selenium and I'm able to call my webinterface and to login. Now I see a bunch of buttons but I can't just simply find them as an element as those are embedded in .js files. I can see them when I click in the browser on 'View Page source':
<script src="web/js/deviceWindow.js"></script>
When I click on deviceWindow.js I can see the Button where I want to click on:
this.setupButton = new Button();
this.setupButton.setText('Settings');
this.setupButton.text.addClass('configBtn');
How can I add this button click to my Python script?
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome('./chromedriver')
driver.get('http://10.143.140.220/login.html')
password = driver.find_element_by_name('password')
password.clear()
password.send_keys('password')
password.send_keys(Keys.RETURN)
I would appreciate any help :-) Thanks!
Your question is unclear, however.. is this helpful?
from selenium.webdriver.support import expected_conditions as EC
[...]
button = WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, "//*[contains(text(), 'Settings')]")))
button.click()