久久久久久久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 檢測圖像中矩形的中心和角度)
    主站蜘蛛池模板: 中文日韩在线 | 国产精品69毛片高清亚洲 | chinese中国真实乱对白 | 欧美精品91 | 亚洲一区二区三区在线观看免费 | 成人在线小视频 | 久久精品成人 | 日韩欧美一区二区三区四区 | 日本一区精品 | 国产成人亚洲精品自产在线 | 一区二区在线不卡 | 国产高清精品在线 | 日本不卡一区二区三区在线观看 | 一级毛片播放 | 亚洲视频区 | 日韩精品人成在线播放 | 精品国产乱码久久久久久图片 | 精品亚洲一区二区 | 免费欧美 | 国产精品观看 | 久久性色 | 成人精品毛片国产亚洲av十九禁 | 亚洲 日本 欧美 中文幕 | 天堂亚洲| 亚洲网址 | 日韩av一区二区在线观看 | 免费黄色特级片 | 国产区在线观看 | 中文字幕一区在线观看视频 | av在线天堂网 | 不卡一区| 久久久久久久久久久久久9999 | 欧美不卡一区二区三区 | av在线免费观看不卡 | 色网站入口 | 欧美精品一区二区三区四区 | 欧美电影一区 | 色婷婷综合久久久中文字幕 | 精品欧美乱码久久久久久 | 亚洲一区二区精品视频在线观看 | 欧美久久国产精品 |