簡體   English   中英

硒不能單擊元素

[英]Selenium cant click element

所以最近我遇到了這個錯誤並解決了這個問題。 我設置了硒,以便用戶輸入文本,並且https://www.dukascopy.com/trading-tools/widgets/quotes/historical_data_feed上的搜索欄顯示數據,但是我無法用我的鼠標單擊結果碼。 我正在嘗試訪問的數據

開始了。 需要通過單擊按鈕來切換搜索欄。

... # Driver initialization, navigating to the page etc.

# The first nested frame
frame_1 = driver.find_element_by_id("widget-container")
driver.switch_to.frame(frame_1)

# The second nested frame
frame_2 = driver.find_element_by_tag_name("iframe")
driver.switch_to.frame(frame_2)

# Toggling the search bar
driver.find_element_by_xpath("//div[contains(text(), 'Instrument')]").click()

# Actually sending in the query
search = driver.find_element_by_xpath("//input[@placeholder='Instrument']")
search.send_keys("Hey there!")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM