Apr-24-2020, 09:13 AM
Hi guys,
I am trying to get some text content from html using Selenium and Chrome webdriver. The snippet of html is:
<span class="explorer__titlesegment explorer__titlesegment--type">Brokerage Account</span>
I am trying to extract the text 'Brokerage Account' which changes depending on situation...
My code in my script is:
thanks
I am trying to get some text content from html using Selenium and Chrome webdriver. The snippet of html is:
<span class="explorer__titlesegment explorer__titlesegment--type">Brokerage Account</span>
I am trying to extract the text 'Brokerage Account' which changes depending on situation...
My code in my script is:
browser = webdriver.Chrome(chromedriver.exe') browser.get(url) time.sleep(5) text = browser.find_element_by_class_name('explorer__titlesegment explorer__titlesegment--type').text print(text)Output:
Output:Error: Message: no such element: Unable to locate element: {"method":"css selector","selector":".explorer__titlesegment explorer__titlesegment--type"}
(Session info: headless chrome=81.0.4044.122)
Any ideas what I am doing wrong please?thanks