This time, I don't know why I can't click the button that I could click it before. So I change the way to click the button to use JavaScript to click.
This commit is contained in:
parent
7d7f57b3f4
commit
52bfb2f526
@ -73,7 +73,9 @@ class BUCTAU:
|
|||||||
try:
|
try:
|
||||||
driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[2]/input').send_keys(self.USER_USERNAME)
|
driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[2]/input').send_keys(self.USER_USERNAME)
|
||||||
driver.find_element(By.XPATH, '//*[@id="password"]').send_keys(self.USER_PASSWORD)
|
driver.find_element(By.XPATH, '//*[@id="password"]').send_keys(self.USER_PASSWORD)
|
||||||
driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[8]/button[1]').click()
|
login_button = driver.find_element(By.XPATH, '/html/body/main/section/div[1]/div[8]/button[1]')
|
||||||
|
driver.execute_script("arguments[0].click();", login_button)
|
||||||
|
# driver.find_element(By.ID,"login-account").click()
|
||||||
return True
|
return True
|
||||||
except selenium.common.exceptions.NoSuchElementException as e:
|
except selenium.common.exceptions.NoSuchElementException as e:
|
||||||
logging.info("NoSuchElementException: ", e)
|
logging.info("NoSuchElementException: ", e)
|
||||||
|
2
run.py
2
run.py
@ -5,7 +5,7 @@ from Authtication import BUCTAU
|
|||||||
def main():
|
def main():
|
||||||
"""Main function to run the script."""
|
"""Main function to run the script."""
|
||||||
authenticator = BUCTAU()
|
authenticator = BUCTAU()
|
||||||
driver = authenticator.init_driver_chrome()
|
driver = authenticator.init_driver_edge()
|
||||||
past_time = time.time()
|
past_time = time.time()
|
||||||
while True:
|
while True:
|
||||||
if time.time() - past_time > 10.0:
|
if time.time() - past_time > 10.0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user