我在网页上有一个文本字段,我想用它来提供数据,但问题是我的 python-selenium 脚本在运行并到达该页面时无法找到它。奇怪的是,当我尝试手动定位此文本字段时,我可以毫无问题地做到这一点。我正在使用 CSSSelector 来定位该字段。
堆栈跟踪:
Traceback (most recent call last):
File "C:/SWInstallation/TestCases/TestCases\Program.py", line 23, in test_UC_QS_FR_01_1_QuikShip_Support
bhp.enterAccDetails("0004341080", "00200")
File "C:\SWInstallation\HC-Branch\src\HomePage.py", line 24, in enterAccDetails
accInputField = self.driver.find_element_by_css_selector("#fields input[name='ACCOUNT_NUMBER']")
File "C:\Python27\lib\selenium\webdriver\remote\webdriver.py", line 366, in find_element_by_css_selector
return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
File "C:\Python27\lib\selenium\webdriver\remote\webdriver.py", line 680, in find_element
{'using': by, 'value': value})['value']
File "C:\Python27\lib\selenium\webdriver\remote\webdriver.py", line 165, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\selenium\webdriver\remote\errorhandler.py", line 158, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: u"Unable to find element with css selector == #fields input[name='ACCOUNT_NUMBER']"