2019年3月21日 星期四

Python Selenium Auto Refresh Webpage


This a.py code uses "geckodriver.exe" in same directory to auto refresh a webpage until specified string is found.


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

driver = webdriver.Firefox()
while True:
    driver.get("http://www.aegpromotion.com/mayday2019")
    if "The system is currently processing ticketing purchase by a large number of customers" not in driver.page_source:
        break
    print('waiting 6 seconds')
    time.sleep(6)
input("Great!")
driver.close()

沒有留言:

張貼留言

202501 Debian USB LAN Card Bridge

 202501 Debian USB LAN Card Bridge ChatGPT Question I have a machine running debian 12 with a LAN port using a cable to connect to my office...