私は、UPS Webサイトからzipcode間の配送時間を引き出すためにpython seleniumスクリプトを使用しています。 "http://ltl.upsfreight.com/shipping/transittimes/transittimes.aspx"Seleniumを使用してWebページのオートメーションで値を取得する
私のshiptimeをキャプチャしようとするまで私のコードは動作します。どのように値を取得するのですか?以下は、キャプチャしたい値 "1"を保持するクロムからのhtmlです。
<span id="app_ctl00_ctl01_lblServiceDays" style="font-weight:bold;">1</span>
とコード自体:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://ltl.upsfreight.com/shipping/transittimes/transittimes.aspx')
driver.find_element_by_id("app_ctl00_ctl00_OriginZipCodeSelector_OriginZipCodeSelector_txtZip").clear()
driver.find_element_by_id("app_ctl00_ctl00_OriginZipCodeSelector_OriginZipCodeSelector_txtZip").send_keys("07042")
driver.find_element_by_id("app_ctl00_ctl00_DestinationZipCodeSelector_DestinationZipCodeSelector_txtZip").clear()
driver.find_element_by_id("app_ctl00_ctl00_DestinationZipCodeSelector_DestinationZipCodeSelector_txtZip").send_keys("07059")
driver.find_element_by_id("app_ctl00_ctl00_btnSubmit").click()
shiptime = driver.find_element_by_id("app_ctl00_ctl01_lblServiceDays")
print (shiptime)
の.textが働いていた( "app_ctl00_ctl01_lblServiceDays") プリント(shiptime)を shiptime = driver.find_element_by_idを返しませんでした。ありがとう。 – polonius11