0

I'm trying to automate a test where my firewall is blocking and injecting a block page. I request "https://github.com/" and firewall will redirect me to block page, where have to click continue "http://140.82.113.4:6080/php/urlblock.php?args=AAAAgwAAABC3o_5b5v4p~8Nxj9GSJnUYAAAAEEJ4JbEXj27LZkEZQvx07FkAAABTAAAAU10wgncDsA~~Rh7f60Nbph0565zRKGoJu7kC4yy1hpCroMzIcTGGmaPkk5gifRV2GQrZT8eUXp3xhShoVW9QmXnkjvraw_yM9gT~W5zgGPcsabze&url=https://github.com%2f"

When I inspect element in Chrome I get the following path:

<input type="submit" name="ok" value="Continue">

Here is my code below and it is not working. If someone can help out that would be great.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time 


YOUR_PAGE_URL = 'https://github.com/'


browser = webdriver.Chrome()
browser.get(YOUR_PAGE_URL)

# button = browser.find_element_by_xpath(NEXT_BUTTON_XPATH)
# button.click()

url_redirect = browser.getTitle()
if (url_redirect.contains ("Web Page Coaching")):
    button_click = browser.find_elements_by_xpath("//input[@name='ok' and @value='Continue']")[0]
    button_click()
  • 1
    Can you check with selenium alert library? This answer can help: https://stackoverflow.com/questions/61859356/how-to-click-the-ok-button-within-an-alert-using-python-selenium – QualityMatters Nov 09 '21 at 09:15

0 Answers0