Hello
I would need any advice for my problem.
The bot need to click a button which will appear on a given time as fast as possible.
The litte problem here is that I quit sure im not allowed to share the html/js part of my
university logged in page.
I will try my best to explain the problem whit the code below.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
path = "C:my_path"
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=\\Users\\aaaa\\AppData\\Local\\Google\\Chrome\\User Data\\")
driver=webdriver.Chrome(path, chrome_options=options)
driver.get("university link")
login = driver.find_element_by_class_name("toolLogin")
login.click()
user = driver.find_element_by_id("username")
user.send_keys("my_username")
pwd = driver.find_element_by_id("password")
pwd.send_keys("my_password")
lgnbtn = driver.find_element_by_id("samlloginbutton")
lgnbtn.click()
until here im just logging in
driver.get("link to get me to the page where the button will appere on first dropdown row")
this leads me to the page where I have to click on a dropdown and now I have a problem.
The register button only appears in the first row of the dropdown at a given time and disappear when all places are occupied.
So my bot needs to click a button (as fast as possible) I don’t now the id, class , path of.
Hello I have a small python script where i need one function to be executed on a given time of a day as accurately as possible.
The script will be running so it’s just that one function in the script.
I would need hour minutes seconds and milliseconds.
is there any way to compare dateime.now() or something like that with that given time and if those are equal running the function?
I don’t know whether that matters or not but I will start the script a few minutes before the one function should be executed.
Hello
I write a bot that should automatically register me for an exam.
The bot should be faster than a human especially the to last lines(will add them below)
I will open the python script a few minutes before the time it need to be executed.
I am looking for a solution to the following problem:
My code (its in production I will change the username and password variable to not be plaintext).
I will also wrap it in functions.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from datetime import datetime
import time
path = "my_path"
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=my_user-data-dir")
driver=webdriver.Chrome(path, chrome_options=options)
time_now = datetime.now()
driver.get("linkt_to_website")
login = driver.find_element_by_class_name("Login")
login.click()
user = driver.find_element_by_id("username")
user.send_keys("my_username")
pwd = driver.find_element_by_id("password")
pwd.send_keys("my_password")
lgnbtn = driver.find_element_by_id("loginbutton")
lgnbtn.click()
driver.get("website linkt to the page with the button to register for my exam")
time.sleep(1)
toggle = driver.execute_script("js function to trigger dropdown menue")
# until here it does not make a difference how much time the bot need
until here everything works fine
the goal is that the bot logs in and wait until a predefined time(hour, minutes, seconds, milliseconds)
but now I have a question:
# the two lines below are the most important
anmed= driver.find_element_by_xpath("register button xpath ").click()
last_btn= driver.find_element_by_xpath("are you sure register button ").click()
The two button I want to trigger in the two lines above will appear at a given time so I need to make a function to trigger the two lines when its for example exactly 10:00:00 in the morning.
I hope this question makes sense.
The main goal is to start the script a few minutes before "10:00:00"AM it logs in and wait until 10AM and as accurately as possible execute the two last lines to actually register for my exam.