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

Selenium 在使用 Python 時無法單擊“獲取數據"

Selenium not able to click on Get Data button on using Python(Selenium 在使用 Python 時無法單擊“獲取數據按鈕)
本文介紹了Selenium 在使用 Python 時無法單擊“獲取數據"按鈕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在從這個網站上抓取數據.元素在下面和geckodriver

I am scraping data from this website . The element is below and geckodriver

<img class="getdata-button" style="float:right;" src="/common/images/btn-get-data.gif" id="get" onclick="document.getElementById('submitMe').click()">

但無法讓 selenium 單擊它甚至嘗試了 xpath、id 但不是運氣是否有任何修復或解決方法來完成它?

but can't get selenium to click it tried even xpath, id but not luck is there any fix or work around to get it done?

推薦答案

要點擊元素 Get Data,您可以使用以下任一 定位器策略:

To click on the element Get Data you can use either of the following Locator Strategies:

  • 使用 css_selector:

driver.find_element_by_css_selector("img.getdata-button#get").click()

  • 使用 xpath:

    driver.find_element_by_xpath("//img[@class='getdata-button' and @id='get']").click()
    

  • 理想情況下,點擊你需要誘導的元素 WebDriverWait 用于 element_to_be_clickable() 并且您可以使用以下任一 定位器策略:

    Ideally, to click on the element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

    • 使用 CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "img.getdata-button#get"))).click()
    

  • 使用 XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//img[@class='getdata-button' and @id='get']"))).click()
    

  • 注意:您必須添加以下導入:

  • Note: You have to add the following imports :

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

  • 這篇關于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视频麻豆 | 麻豆91av | 久色一区 | 黄色网址免费在线观看 | 久草在线青青草 | 日韩一级黄色毛片 | 亚洲精品一区二区二区 | 久久精品—区二区三区 | 男人的天堂中文字幕 | 国产精品观看 | 成人免费一区二区三区牛牛 | 自拍偷拍一区二区三区 | 91免费看片 | 国产不卡视频 | 99精品欧美一区二区三区 | 91久久国产综合久久 | 先锋影音资源网站 | 久久伊人精品一区二区三区 | 色噜噜亚洲男人的天堂 | 狠狠做六月爱婷婷综合aⅴ 国产精品视频网 | 国产一区二区三区 | 国产午夜在线观看 | 欧美日韩一区二区在线 | 久久精品久久综合 | 国产一区二区久久 | 久久精品综合 | 国产高清视频一区 | 亚洲精品小视频在线观看 | 国产精品精品久久久 | 国产精品久久久久久久一区二区 | 精品一区二区三区91 | 亚洲视频在线观看 | 特一级毛片 | 国产一二区视频 | 中文字幕免费视频 | 91精品国产欧美一区二区 | 国产传媒在线播放 | 久久久久国产一区二区三区四区 | 日日夜夜操天天干 | 91亚洲国产成人久久精品网站 |