I want to import selenium WebElement
since I need to check if a function returns a WebElement
or not
I have googled but only find how to import selenium, such as from selenium import webdriver
, I already have that working. The error part is the type checking line such as:
if isinstance(var, WebElement):
#do something
else:
#do nothing
so the question is what is the class path for selenium's WebElement
? for example from selenium.common import WebElement
(already tried this and not working)
To install the Selenium bindings in our system, run the command: pip install selenium. As this is done, a folder called Selenium should get created within the Python folder. To update the existing version of Selenium, run the command: pip install –U selenium.
The selenium package is used to automate web browser interaction from Python.
in case someone did not see the answer, its in the comment:
from selenium.webdriver.remote.webelement import WebElement
i'm adding this answer to close this question, thanks for the help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With