Selenium - 日历选择器 - Select 当前日期 NoSuchElementException Python 3
Selenium - Calendar Picker - Select Current Day NoSuchElementException Python 3
问题出在我浏览页面的方法上。我必须 select 实际日历然后 select 当前日期。下面的代码是更新后的正确代码。
from selenium import webdriver
import time
driver = webdriver.Firefox()
#navigates to website
driver.get('https://www.sosnc.gov/online_services/search/by_title/_Business_Registration_changes')
#select calendar
driver.find_element_by_xpath('/html/body/div[2]/main/article/div/form/article/section/div/div[2]/label').click()
time.sleep(3)
#select current calendar date
driver.find_element_by_css_selector('.ui-datepicker-today').click()
time.sleep(2)
#select and click search button
driver.find_element_by_xpath('//*[@id="Search"]').click()
我已将上面的代码更新为正确的代码,并对解决方案进行了解释。
from selenium import webdriver
import time
driver = webdriver.Firefox()
#navigates to website
driver.get('https://www.sosnc.gov/online_services/search/by_title/_Business_Registration_changes')
#select calendar
driver.find_element_by_xpath('/html/body/div[2]/main/article/div/form/article/section/div/div[2]/label').click()
time.sleep(3)
#select current calendar date
driver.find_element_by_css_selector('.ui-datepicker-today').click()
time.sleep(2)
#select and click search button
driver.find_element_by_xpath('//*[@id="Search"]').click()
问题出在我浏览页面的方法上。我必须 select 实际日历然后 select 当前日期。下面的代码是更新后的正确代码。
from selenium import webdriver
import time
driver = webdriver.Firefox()
#navigates to website
driver.get('https://www.sosnc.gov/online_services/search/by_title/_Business_Registration_changes')
#select calendar
driver.find_element_by_xpath('/html/body/div[2]/main/article/div/form/article/section/div/div[2]/label').click()
time.sleep(3)
#select current calendar date
driver.find_element_by_css_selector('.ui-datepicker-today').click()
time.sleep(2)
#select and click search button
driver.find_element_by_xpath('//*[@id="Search"]').click()
我已将上面的代码更新为正确的代码,并对解决方案进行了解释。
from selenium import webdriver
import time
driver = webdriver.Firefox()
#navigates to website
driver.get('https://www.sosnc.gov/online_services/search/by_title/_Business_Registration_changes')
#select calendar
driver.find_element_by_xpath('/html/body/div[2]/main/article/div/form/article/section/div/div[2]/label').click()
time.sleep(3)
#select current calendar date
driver.find_element_by_css_selector('.ui-datepicker-today').click()
time.sleep(2)
#select and click search button
driver.find_element_by_xpath('//*[@id="Search"]').click()