Selenium Python을 처음 사용했습니다. 다음 스 니펫을 실행하려고합니다. find_element_by_name과 작동하지만 find_element_by_xpath는 작동하지 않습니다.셀레늄 파이썬에서 xpath를 사용하는 방법?
내가 뭘 잘못하고 있는지 알기!
감사
from selenium import webdriver
# create a new Firefox session
driver = webdriver.Firefox()
driver.implicitly_wait(10)
driver.maximize_window()
# navigate to the application home page
driver.get("https://www.google.co.uk/")
# get the search textbox
#search_field = driver.find_element_by_xpath("//@name='q'/") <<<<< NOT Working
search_field = driver.find_element_by_name("q")
search_field.clear()
# enter search keyword and submit
search_field.send_keys("phones")
search_field.submit()
시도 입력 \ [NAME ='Q '@] 이어야하며 당신을 위해 일한 다음 올바른 것으로 표시하십시오. –