내 코드는 다음과 같습니다.
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
browser = webdriver.Firefox()
browser.get('https://pbx.voxbaysolutions.com/#/page/signin')
browser.find_element_by_xpath('//input[@ng-model="user.name"]').send_keys('thj')
다음은 오류입니다.
Traceback (most recent call last):
File "voxbay_automate.py", line 8, in <module>
browser.find_element_by_xpath('//input[@ng-model="user.name"]').send_keys('thj')
File "C:\Users\theju\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webd
river\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\theju\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webd
river\remote\webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\theju\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webd
river\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\theju\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webd
river\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@ng-model="user.name"]
요소를 가져 오는 중
<input type="text" name="name" ng-model="user.name" class="form-control ng-pristine ng-invalid ng-invalid-required ng-touched" placeholder="User email" required="" tabindex="0" aria-required="true" aria-invalid="true">
키를 보내기 전에 웹 요소가로드 될 때까지 기다리십시오.
WebDriverWait(browser, 30).until(EC.visibility_of_element_located((By.XPATH, '//input[@ng-model="user.name"]'))).send_keys('thj')
다음 가져 오기가 필요합니다.
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다