Home > Back-end >  How to get text by Selenium and Python
How to get text by Selenium and Python

Time:05-10

I have a problem in getting text from Html by Selenium and Python

inerHtml

<span data-select="" data-selected="Selected" data-deselect="Press enter to remove" ><span>ONE</span></span> <!---->
<span data-select="" data-selected="Selected" data-deselect="Press enter to remove" ><span>TWO</span></span> <!---->
<span data-select="" data-selected="Selected" data-deselect="Press enter to remove" ><span>THREE</span></span> <!---->

I want to take the text.

Try:

a.find_element(By.CSS_SELECTOR,'span > span').text

but I failed.

CodePudding user response:

Try:

a.find_element(By.CLASS_NAME, "multiselect__option").text
  • Related