Answer the question
In order to leave comments, you need to log in
How to handle span click selenium?
Good evening, just today I came across the "selenium" library and I can't process clicking on "span".
Probyval:
element = driver.find_element_by_xpath('span[contains(text(), "Показать комментарии")]').click()
element = driver.find_element_by_xpath('/html/body/div[2]/main/section/div/div[4]/div[1]/ul/li[2]/span').click()
element = driver.find_element_by_xpath('/html/body/div[2]/main/section/div/div[4]/div[1]/ul/li[2]/span/span[1]').click()
from selenium import webdriver
def get_title(tengri_url) -> str:
driver = webdriver.Chrome()
driver.get(tengri_url)
element = driver.find_element_by_xpath('/html/body/div[2]/main/section/div/div[4]/div[1]/ul/li[2]/span').click()
return element
print(get_title('https://tengrinews.kz/world_news/vlasti-yaponii-predlagayut-rassledovat-deystviya-voz-402462/'))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question