久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

ElementClickInterceptedException:消息:元素點擊被攔截

ElementClickInterceptedException: Message: element click intercepted: Element lt;labelgt; is not clickable with Selenium and Python(ElementClickInterceptedException:消息:元素點擊被攔截:元素lt;標簽gt;Selenium 和 Python 不可點擊
本文介紹了ElementClickInterceptedException:消息:元素點擊被攔截:元素<標簽>Selenium 和 Python 不可點擊的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試單擊所有主題"和所有狀態"復選框,然后搜索結果.當我運行腳本時,會打開一個大小為 1036x674 的 chrome 窗口.

I am trying to click on the "All Topics" and "All States" CheckBoxes then search the results. When I run the script, a chrome window opens up in size 1036x674.

如果我不理會窗口,我會收到元素點擊攔截錯誤.如果我最小化或最大化窗口,我的腳本可以正常工作.

If I leave the window alone, I get element click interception errors. If I minimize or maximize the window, my script works fine.

我正在使用 Selenium 3.141.0、chrome 76、chromedriver 76 和 python 3.6

I am using Selenium 3.141.0, chrome 76, chromedriver 76, and python 3.6

chromedriver_path = r"C:Userspath	ochromedriver.exe"
browser = webdriver.Chrome(executable_path=chromedriver_path)
url = "http://www.ncsl.org/research/transportation/autonomous-vehicles-legislative-database.aspx"

topics_xpath = "http://*[@id="dnn_ctr81355_StateNetDB_UpdatePanel1"]/div[1]/div[2]/span/label"
states_xpath = "http://*[@id="dnn_ctr81355_StateNetDB_UpdatePanel1"]/div[2]/div[2]/span/label"
browser.get(url)
time.sleep(30)

elem = browser.find_element_by_xpath(topics_xpath)
elem.click()
time.sleep(5)
elem = browser.find_element_by_xpath(states_xpath)
elem.click()

但我得到這個錯誤:

ElementClickInterceptedException:消息:元素點擊被攔截:
元素 在點 (259, 665) 處不可點擊.
其他元素會收到點擊:

ElementClickInterceptedException: Message: element click intercepted:
Element <label for="dnn_ctr81355_StateNetDB_ckBxAllTopics">...</label> is not clickable at point (259, 665).
Other element would receive the click:
<label for="dnn_ctr81355_StateNetDB_ckBxTopics_0">...</label>
(Session info: chrome=76.0.3809.100)

將被點擊的復選框就在我試圖點擊的復選框的正下方.

The CheckBox that would be clicked is right below the one I am trying to click.

推薦答案

你需要WebDriverWait來確定元素visibility_of_element_located,然后滾動到Searchable Database 部分,您可以通過 xpath 使用定位器.

You need WebDriverWait to make sure the element visibility_of_element_located, then scroll to Searchable Database section, and you can use locator by xpath.

請導入:

from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

試試下面的代碼.

chromedriver_path = r"C:Userspath	ochromedriver.exe"
browser = webdriver.Chrome(executable_path=chromedriver_path)
url = "http://www.ncsl.org/research/transportation/autonomous-vehicles-legislative-database.aspx"

topics_xpath = "//div[@class='divTopicsSection1']//span//label[text()='All Topics']"
states_xpath = "//div[@class='divStatesSection1']//span//label[text()='All States']"
dBase_xpath = "//h4[text()='Searchable Database']"
browser.get(url)
WebDriverWait(browser, 10).until(expected_conditions.visibility_of_element_located((By.XPATH, topics_xpath)))
elem = browser.find_element_by_xpath(dBase_xpath)
browser.execute_script("arguments[0].scrollIntoView(true);", elem)

browser.find_element_by_xpath(topics_xpath).click()
browser.find_element_by_xpath(states_xpath).click()

這篇關于ElementClickInterceptedException:消息:元素點擊被攔截:元素&lt;標簽&gt;Selenium 和 Python 不可點擊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 中文字幕一区在线 | 一级毛片免费播放视频 | 日韩综合精品 | 国产精品免费人成网站酒店 | 黄视频网站在线观看 | 91在线观 | 午夜在线免费观看 | 欧美日韩一区二区在线 | 国产视频一区在线 | 国产黄色一级片 | 欧美精品二区三区四区免费看视频 | 国产第二页 | 黄色日皮视频 | 九九精品在线视频 | www.欧美日韩 | 日本成人一区二区 | jlzzzjlzzz国产免费观看 | 日韩在线免费观看视频 | 国产在线黄色 | 日本理论片午伦夜理片在线观看 | 午夜激情视频在线观看 | 五月天激情婷婷 | 中文在线字幕免费观 | 日本免费毛片 | 青青草网站 | 97精品视频在线观看 | 青青国产 | 偷偷操不一样 | 亚洲一区在线视频 | 色综合小说 | 夜夜嗨av一区二区三区网页 | 精品一区视频 | 福利av在线 | 欧美色综合天天久久综合精品 | 久久精品久久久 | 91久久国产综合久久 | 国产成人福利 | 国产在线不卡 | 精品国产一二三区 | 天美传媒在线观看 | av国产精品|