Error using "find_element" command in python Selenium

Asked

Viewed 241 times

0

I am programming a boot that interacts with a google page (google Meet) for this I am Selenium, but when I use the command find_element in python it gives the following error:

Selenium.common.exceptions.Nosuchelementexception: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[1]/div[3]/div/div[2]/div[3]/div/span/span"}

probably not error the page still not have loaded because I put a 20 seconds Sleep

here is my code:

import os
from datetime import date
from datetime import datetime
from time import sleep
import selenium
from selenium import webdriver

hora = 360
driver = selenium.webdriver.Chrome(r"C:\Users\adelson\Desktop\chromedriver")

def segunda():
    if now.hour == 21:
        os.startfile('link da reunião')
        sleep(20)
        my_button = driver.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[2]/div[3]/div/span/span")
        my_button.click()
        sleep(hora)

while True:

    now = datetime.now()
    data = date(now.year, now.month, now.day)

#segunda
    if data.isoweekday() == 1:
        segunda()
    sleep(120)

1 answer

1


Check your xpath if it is correct, this error occurs by not finding the element, which may be caused by the time of the application or the xpath is incorrect.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.