1

I want to save a text, as a variable, from a website with python.

driver.find_element_by_class_name('plaint').storetext()

I don't know how to do this right. Thanks

  • Possible duplicate of [Python and how to get text from Selenium element WebElement object?](https://stackoverflow.com/questions/28022764/python-and-how-to-get-text-from-selenium-element-webelement-object) – JeffC Mar 05 '19 at 16:42

1 Answers1

1

Instead of using selenium to store the text why not try just grabbing the information and storing it into your own variable.

element_to_store = driver.find_element_by_class_name("class name").text()

Lets say you use class name and .text() to find an element and its text value. once you use element_to_store to find the text, you can then use element_to_store and call it when you need it as its value is the .text() string of the element you searched for.

Julian Silvestri
  • 1,970
  • 1
  • 15
  • 33