进行ui 页面登录测试时, 总是报错,xpath核对了很多遍,没有问题, 但是报错找不到no such element: Unable to locate element

提问 5 161
syh
syh LV2 2023年11月16日 13:49 编辑
<p id="descriptionP"><p><spanby: xpath="" expression:="" *[@id="root" ]="" div="" div[2]="" span="" input'<br="">2023-11-16 11:17:06.772568 - Debug - WEB操作[输入]结束<br>2023-11-16 11:17:06.960070 - Error - Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="root"]/div/div[2]/div/div[2]/div/span/input"} (Session info: chrome=91.0.4472.77) <br>2023-11-16 11:17:06.965977 - Error - 程序错误信息: <br>Traceback (most recent call last): <br> File "/usr/local/lib/python3.8/unittest/case.py", line 60, in testPartExecutor yield <br> File "/usr/local/lib/python3.8/unittest/case.py", line 676, in run self._callTestMethod(testMethod) <br> File "/usr/local/lib/python3.8/unittest/case.py", line 633, in _callTestMethod method() <br> File "/liuma/lm/lm_case.py", line 29, in testEntrance WebTestCase(test=self).execute() <br> File "/liuma/core/web/testcase.py", line 30, in execute self.loop_execute(self.case_message['optList'], []) <br> File "/liuma/core/web/testcase.py", line 64, in loop_execute raise e <br> File "/liuma/core/web/testcase.py", line 57, in loop_execute step.execute() <br> File "/liuma/core/web/teststep.py", line 39, in execute self.result = func(self.test, self.driver, **opt_content) <br> File "/liuma/core/web/find_opt.py", line 158, in input Page(test, driver).input_text(kwargs["element"]["element"], kwargs["data"]["text"]) <br> File "/liuma/core/web/driver/pageOpt.py", line 103, in input_text raise e <br> File "/liuma/core/web/driver/pageOpt.py", line 100, in input_text self.find_element(element).send_keys(text) <br> File "/liuma/core/web/driver/__init__.py", line 18, in find_element raise e <br> File "/liuma/core/web/driver/__init__.py", line 13, in find_element element = self.driver.find_element(*tuple(ele)) <br> File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { <br> File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) <br> File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) <br>selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="root"]/div/div[2]/div/div[2]/div/span/input"} (Session info: chrome=91.0.4472.77)&nbsp; &nbsp;&nbsp;</spanby:><br></p></p><p><br></p><p><br></p><p><br></p><p><br></p><p><img src="http://talk-cdn.liumatest.cn/2eb54698-dd94-4180-961d-ab22db07dfed.png" style="max-width:100%;"><img src="http://talk-cdn.liumatest.cn/5ec2048a-f507-453a-9699-d0b7346a2dd0.png" style="max-width: 100%;"><br></p>
收藏(0)  分享
相关标签: 提问
注意:本文归作者所有,未经作者允许,不得转载
5个回复
  • Chras-fu
    2023年11月16日 11:27
    截图看下不就知道了吗,肯定是页面打开的不对
    0 4