0

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 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')
8
  • 1
    chromedriver injects a dll. This is likely what's causing the warning. You probably need to whitelist chromedriver.exe. Commented Nov 22, 2022 at 6:33
  • 1
    The thing that's complaining is "Windows Security", a part of Windows. I would suggest searching "windows 10 security whitelist" Commented Nov 22, 2022 at 6:48
  • 1
    You don't avoid it. The injection is required in order for Selenium to work. Commented Nov 22, 2022 at 6:49
  • 1
    No. It has to do with Windows security settings. If you're not an administrator on that computer, you won't be able to use Selenium on that computer. Commented Nov 22, 2022 at 6:56
  • 1
    Maybe Debanjan will be able to help. stackoverflow.com/users/7429447/undetected-selenium Commented Nov 24, 2022 at 7:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.