Python Forum
Looping/Scheduling webelement select
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping/Scheduling webelement select
#1
Hi guys,

I am wanting help with either turning this below code into either a For statement so I can ultimately create a loop for hourly or scheduling the below code to schedule it every hour:

from selenium import webdriver
from selenium import webdriver
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time
import schedule
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By


driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://www.google.com/search?q=bing&source=lnms&tbm=nws&sa=X&ved=2ahUKEwjfy6yg0dnwAhWFvZ4KHV07BuQQ_AUoA3oECAEQBQ&biw=1036&bih=812&dpr=1.5")
button = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[7]/div/div[3]/div/div[1]/div/div[1]/div/div[4]")))
button.click()    
Reply
#2
remove 2 of the 3 imports lines 1-3
you can use 'sched' ( https://docs.python.org/3/library/sched.html ) for scheduling,

or do it from OS command with cron (Linux), not sure what windows equivalent is.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Webelement scroll rove76 1 2,088 Mar-17-2020, 05:38 PM
Last Post: rove76

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020