As the title suggest i am wondering how to convert a selenium web element list in a normal list. Im am aware that .text can be used at the end of a variable but cant work out how to put it into a list from there. Hope this can be understood.
Thanks in advance
CodePudding user response:
Here is an example of how you can get a list with text content for elements in a list:
[...]
wait = WebDriverWait(browser, 20)
[...]
list_with_elements = [x.text for x in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, 'h2[]')))]
Selenium docs can be found here: https://www.selenium.dev/documentation/