am05mhz
am05mhz

Reputation: 2875

how to import selenium WebElement in python

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)

Upvotes: 14

Views: 16222

Answers (1)

am05mhz
am05mhz

Reputation: 2875

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

Upvotes: 26

Related Questions