Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.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 3.x Chrome和Mozilla中的Xpath不同,用于标识在seleniumpython中工作的相同元素复选框_Python 3.x_Selenium_Xpath - Fatal编程技术网

Python 3.x Chrome和Mozilla中的Xpath不同,用于标识在seleniumpython中工作的相同元素复选框

Python 3.x Chrome和Mozilla中的Xpath不同,用于标识在seleniumpython中工作的相同元素复选框,python-3.x,selenium,xpath,Python 3.x,Selenium,Xpath,该复选框对Chrome(版本81.0.4044.138)和Firefox(版本76.0.1(64位))具有不同的xpath,它一次只对一个xpath有效,我得到以下错误: ===========================================测试会话开始============================= 平台win32——Python 3.7.4、pytest-5.4.1、py-1.8.1、Plugy-0.13.1 rootdir:C:\eclipse-workspace

该复选框对Chrome(版本81.0.4044.138)和Firefox(版本76.0.1(64位))具有不同的xpath,它一次只对一个xpath有效,我得到以下错误:

===========================================测试会话开始============================= 平台win32——Python 3.7.4、pytest-5.4.1、py-1.8.1、Plugy-0.13.1 rootdir:C:\eclipse-workspace2\Hybrid Framework 插件:allure-pytest-2.8.13 收集了3个项目

Testcases\test\u login.py sF INTERNALERROR>回溯(最近一次呼叫上次): 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python37\lib\site-packages\u pytest\main.py”,第191行,在wrap\u会话中 INTERNALERROR>session.exitstatus=doit(配置,会话)或0 INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site-packages\u pytest\main.py”,第247行,在\u main中 INTERNALERROR>config.hook.pytest\u runtestloop(session=session) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\hooks.py”,第286行,在调用中 INTERNALERROR>返回self.\u hookexec(self,self.get\u hookimpls(),kwargs) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\manager.py”,第93行,在 内部错误>返回自我。\u内部\u hookexec(钩子、方法、kwargs) 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\manager.py”,第87行,在 INTERNALERROR>firstresult=hook.spec.opts.get(“firstresult”)如果hook.spec else为False, INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,第208行,在多调用中 INTERNALERROR>返回结果。获取结果() 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,get\U结果中的第80行 INTERNALERROR>raise ex.带_回溯(ex[2]) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,第187行,在多调用中 INTERNALERROR>res=hook_impl.function(*args) 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python37\lib\site-packages\u pytest\main.py”,第272行,在pytest\u runtestloop中 INTERNALERROR>item.config.hook.pytest\u runtest\u协议(item=item,nextitem=nextitem) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\hooks.py”,第286行,在调用中 INTERNALERROR>返回self.\u hookexec(self,self.get\u hookimpls(),kwargs) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\manager.py”,第93行,在 内部错误>返回自我。\u内部\u hookexec(钩子、方法、kwargs) 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\manager.py”,第87行,在 INTERNALERROR>firstresult=hook.spec.opts.get(“firstresult”)如果hook.spec else为False, INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,第208行,在多调用中 INTERNALERROR>返回结果。获取结果() 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,get\U结果中的第80行 INTERNALERROR>raise ex.带_回溯(ex[2]) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,第187行,在多调用中 INTERNALERROR>res=hook_impl.function(*args) 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python37\lib\site-packages\u pytest\runner.py”,pytest\u runtest\u协议第85行 INTERNALERROR>runtestprotocol(项,nextitem=nextitem) runtestprotocol中的INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site-packages\u pytest\runner.py”,第100行 INTERNALERROR>reports.append(调用和报告(项目“调用”,日志)) 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python37\lib\site-packages\u pytest\runner.py”,第190行,在call\u和\u报告中 INTERNALERROR>hook.pytest\u runtest\u logreport(report=report) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\hooks.py”,第286行,在调用中 INTERNALERROR>返回self.\u hookexec(self,self.get\u hookimpls(),kwargs) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\manager.py”,第93行,在 内部错误>返回自我。\u内部\u hookexec(钩子、方法、kwargs) 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\manager.py”,第87行,在 INTERNALERROR>firstresult=hook.spec.opts.get(“firstresult”)如果hook.spec else为False, INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,第208行,在多调用中 INTERNALERROR>返回结果。获取结果() 内部错误>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,get\U结果中的第80行 INTERNALERROR>raise ex.带_回溯(ex[2]) INTERNALERROR>文件“C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site packages\pluggy\callers.py”,第187行,在多调用中 INTERNALERROR>res=hook_impl.function(*args) 内部错误>文件“C:\Users\Owner.p2\pool\plugins\org.python.pydev.core_7.5.0.202001101138\pysrc\u pydev\u runfiles\pydev\u runfiles\u pytest2.py”,第243行,在pytest\u runtest\u日志报告中 INTERNALERROR>exc=\u从报告(报告)中获取\u错误\u内容\u INTERNALERROR>文件“C:\Users\Owner.p2\pool\plugins\org.python.pydev.core\u 7.5.0.202001101138\pysrc\u pydev\u runfiles\pydev\u runfiles\u pytest2.py”,第147行,从报告中获取错误内容 INTERNALERROR>report.toterminal(tw) 内部误差
//div[@class="za-tos-container"]
driver.find_element_by_xpath("//input[@id='tos']") 
 driver.find_element_by_id("tos")
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH,"//input[@id='tos']"))).click()