我試圖抓取這個頁面(“ http://www.arohan.in/branch-locator.php ”),當我選擇州和城市時,將顯示一個地址,我必須寫下州,城市和 csv/excel 文件中的地址。我能夠到達這一步,現在我被卡住了。這是我的代碼:from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWaitchrome_path= r"C:\Users\IBM_ADMIN\Downloads\chromedriver_win32\chromedriver.exe"driver =webdriver.Chrome(chrome_path)driver.get("http://www.arohan.in/branch-locator.php")select = Select(driver.find_element_by_name('state'))select.select_by_visible_text('Bihar')drop = Select(driver.find_element_by_name('branch'))city_option = WebDriverWait(driver, 5).until(lambda x: x.find_element_by_xpath("//select[@id='city1']/option[text()='Gaya']"))city_option.click()
添加回答
舉報
0/150
提交
取消