简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM