D
D
Dizzy Qucile2020-05-17 18:54:41
Python
Dizzy Qucile, 2020-05-17 18:54:41

How to handle span click selenium?

Good evening, just today I came across the "selenium" library and I can't process clicking on "span".
5ec15d01108a1314782360.png

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()


Well, nothing came out, please help.

Whole code:
spoiler
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/'))


The site itself: https://tengrinews.kz/economic/mirovoy-ekonomike-p... and there below "Show comments"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1001001, 2020-05-17
@DiZiNnEs

//span[contains(text(), "Показать комментарии")]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question