B
B
bhusnullin2019-08-10 22:26:52
Python
bhusnullin, 2019-08-10 22:26:52

How to solve this error in Selenium Python?

Here is the code:

import selenium
import time 
from selenium import webdriver 
from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.common.by import By 
from selenium.common.exceptions import NoSuchElementException

driver = webdriver.Firefox() 
driver.get("https://toster.ru/") 
time.sleep(7) 
driver.refresh() 
time.sleep(3) 
link = driver.find_element_by_xpath("/html/body/div/div/div/div/div[6]/div/div[2]/a") 
link.click()

Throws an error: self.error_handler.check_response(response)
File "C:\Program Files (x86)\Python37-32\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class (message, screen, stacktrace)
What to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
Herr_Konrad, 2019-08-11
@Herr_Konrad

link = driver.find_element_by_xpath("/html/body/div/div/div/div/div[6]/div/div[2]/a")

This element does not exist, check xpath again

D
Dimonchik, 2019-08-11
@dimonchik2013

"/html/body/div/div/div/div/div<b>[6]</b>/div/div<b>[2]</b>/a"

bad tone with numbers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question