I'm automating a web page with selenium-python where there's a hidden JavaScript
button. The HTML is this:
<script type="text/javascript"> add_itemtitle("Restart"); </script><div class="content_item_title">Restart</div>
<div class="maintenance_item">
<div class="maintenance_item_desc">
Click <b>Restart</b> to restart device
</div>
<div class="maintenance_item_butt">
<script language="JavaScript" type="text/javascript">
create_button("Restart","btnReboot");
</script><span class="button_wrapper" id="btnReboot"><span class="button_left"><span class="button_right"><span class="button_center">Restart</span></span></span></span>
</div>
</div>
I have been using following codes but it didn't worked for me.
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="btnReboot"]'))).click()
and execute_script
"""working with javascript buttton """
#1
#element=WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[text()[contains(.,'Restart')]]")))
#driver.execute_script("arguments[0].click();", element)
#2
#element=WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//span[text()='Restart']"))).click()
#driver.execute_script("arguments[0].click();", element)
#3
#submit_button = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[text()[contains(.,'submitButton')]]")))
#driver.execute_script("arguments[0].click();", submit_button)
leads to Virus&theart protection
Controlled folder access blocked chromedriver.exe from making changes.ckick to see setting.
is there any selenium option like following to evade the Virus&theart protection
options.add_argument("start-maximized")
#disable security content
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--allow-insecure-localhost')
chromedriver.exe
. – Cerulean