So I have Selenium code that goes to a page using chrome. Now at that page, there is this HTML;
<span ngbind="pageData.Message">Heloooo</span>
How can I get the value using python and Selenium? So only the Heloooo
.
Thanks!
So I have Selenium code that goes to a page using chrome. Now at that page, there is this HTML;
<span ngbind="pageData.Message">Heloooo</span>
How can I get the value using python and Selenium? So only the Heloooo
.
Thanks!
You can use the following CSS Selector for locating the element:
span[ngbind='pageData.Message']
Code:
element = driver.find_element_by_css_selector("span[ngbind='pageData.Message']")
print(element.text) # Will print the "Heloooo" value.
Hope it helps you!
You can try using XPath to get the text of the element:
element1 = driver.find_element_by_xpath("//span[@ngbind='pageData.Message']")
print(element1.text)
It's just another option.