Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Selenium、Firefox、错误检查页面上是否有ID?_Python_Selenium_Firefox_Webdriver - Fatal编程技术网

Python Selenium、Firefox、错误检查页面上是否有ID?

Python Selenium、Firefox、错误检查页面上是否有ID?,python,selenium,firefox,webdriver,Python,Selenium,Firefox,Webdriver,对不起,如果这是一种模糊,我不知道如何解释它,但基本上我正在尝试运行一个功能,检查一个ID是否在一个页面上,我不知道如何做。这是我迄今为止尝试的代码 def checkoutpage(): driver1.find_element_by_id('test') try: if checkoutpage == True: print("Working") else: print("Not working") except: print

对不起,如果这是一种模糊,我不知道如何解释它,但基本上我正在尝试运行一个功能,检查一个ID是否在一个页面上,我不知道如何做。这是我迄今为止尝试的代码

def checkoutpage():
    driver1.find_element_by_id('test')
try:
    if checkoutpage == True:
        print("Working")
    else: 
        print("Not working")
except:
    print("ERROR")
无论ID是否在页面上,它都返回不起作用,非常感谢您的帮助。

另一个简单示例的可能重复