我想要在這個拍賣網站上填寫表格。現在我需要弄清楚如何選擇懸停菜單上的選項。我試着在這裏查看其他問題,但他們都有XPATH或CSS作爲識別子菜單選項的方法。我無法用我的瀏覽器檢查該選項,我會很感激任何見解!蟒蛇硒選擇下拉菜單選項
什麼的分配按鈕的代碼:
HTML 2 - 當我將鼠標懸停在「添加拍賣分配」好像它使一種叫做一個javascript彈出,但我不知道。
下面是我到目前爲止的代碼和我嘗試的方法。它確實找到了分配按鈕,它確實懸停在它上面,但它總是超時。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import Select
browser = webdriver.Chrome("C:\Program Files\chromedriver_win32/chromedriver.exe")
actions = ActionChains(browser)
#Go to the desired website
browser.get("http://www.autoims.com/external/index.jsp")
usrname_box = browser.find_element_by_xpath('//*[@id="loginUsername"]')
pw_box = browser.find_element_by_xpath('//*[@id="password"]')
login_button = browser.find_element_by_xpath('//*[@id="submit"]')
#login process here
wait = WebDriverWait(browser, 10)
for vin in df['VIN']:
assignments = wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="_img0"]')))
ActionChains(browser).move_to_element(assignments).perform()
add_assignment = wait.until(EC.visibility_of_element_located((By.XPATH, " HELP :( "))) #always fails
ActionChains(browser).move_to_element(add_assignment).click().perform()
您可以在標記中找到文字「添加拍賣作業」嗎? –
我不知道。當我將鼠標懸停在任務上時,我所看到的是圖像更改的src。 SRC =「/images/menu/internal/btn_assingments.jpg」改變爲---「SRC =「/images/menu/internal/btn_assignments_on.jpg」 「」 – Saul
你確認,當你查看源代碼的網頁,搜索它不存在的文本? –