Answer the question
In order to leave comments, you need to log in
Bug in Python 3 when the code is almost the same?
There are two versions of the code, the first one works, the second one doesn't. The first is a simplified second, I simplified it to identify the error. But the first code works. The difference between them is that in the second option there are transitions, but I have already run out of guesses. The error occurs on the second iteration of the loop, on this line:
t = driver.find_element_by_xpath(".//*[@id='list']/li["+str(i)+"]")
i = 1
while i < 10:
t = driver.find_element_by_xpath(".//*[@id='list']/li["+str(i)+"]/a")
el_text = t.text
print (el_text)
i = i + 1
i = 1
while i < 6:
t = driver.find_element_by_xpath(".//*[@id='list']/li["+str(i)+"]")
el_text = t.text
driver.find_element_by_tag_name("html").send_keys(Keys.CONTROL + 't') //открывает новую вкладку - эти комментарии только в этом посте, в коде их нет
driver.get(el_text)
driver.find_element_by_tag_name("html").send_keys(Keys.CONTROL + '1') //переходит на первую
i = i + 1
print (i)
Answer the question
In order to leave comments, you need to log in
Sorry, I didn't understand, did my answer to your previous question help you? If so, why isn't it marked as a solution? If not, why didn't you add specifics to the old post and create a new one?
On the topic of the current question:
t = driver.find_element_by_xpath(".//*[@id='list']/li["+str(i)+"]")
el_text = t.text
driver.get(el_text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question