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

如何使用 unselectable=“on"選擇劍道下拉元素使

How to select kendo dropdown element with unselectable=quot;onquot; attribute using Selenium and Python(如何使用 unselectable=“on選擇劍道下拉元素使用 Selenium 和 Python 的屬性)
本文介紹了如何使用 unselectable=“on"選擇劍道下拉元素使用 Selenium 和 Python 的屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

無法使用以下代碼選擇劍道下拉菜單.可以訪問該站點以檢查代碼.

<span unselectable="on" class="k-dropdown-wrap k-state-default"><span unselectable="on" class="k-input">Chang</span><span unselectable="on" class="k-select" aria-label="select"><span class="k-icon ki-arrow-60-down"></span></span></span>代碼:從硒導入網絡驅動程序從 selenium.webdriver.common.action_chains 導入 ActionChains從 selenium.webdriver.support.select 導入選擇從 selenium.webdriver.common.keys 導入密鑰進口時間driver = webdriver.Chrome('./chromedriver')driver.get("https://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource")select = driver.find_element_by_xpath('//*[@id="example"]/div/span/span/span[1]')[0]select.SelectByValue("Chang");打印('成功')

解決方案

使用

Unable to select the kendo dropdown using below code. The site can be reachable for checking the code.

<span unselectable="on" class="k-dropdown-wrap k-state-default"><span unselectable="on" class="k-input">Chang</span><span unselectable="on" class="k-select" aria-label="select"><span class="k-icon k-i-arrow-60-down"></span></span></span>



Code: 
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome('./chromedriver')
driver.get("https://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource")
select = driver.find_element_by_xpath('//*[@id="example"]/div/span/span/span[1]')[0]
select.SelectByValue("Chang");
print('Success')

解決方案

To select the item with text as Chang within the kendo dropdown using Selenium you you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    driver.get("https://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "span.k-widget.k-dropdown[aria-owns='products_listbox']"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.k-animation-container>div#products-list ul li[data-offset-index='1']"))).click()
    

  • Using XPATH:

    driver.get("https://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "http://span[@class='k-widget k-dropdown' and @aria-owns='products_listbox']"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "http://div[@class='k-animation-container']/div[@id='products-list']//ul//li[text()='Chang']"))).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
    

Browser Snapshot:

這篇關于如何使用 unselectable=“on"選擇劍道下拉元素使用 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 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 国产ts一区 | 欧美在线观看一区二区 | 一级片av | 福利一区视频 | 亚洲大片 | 99国产精品视频免费观看一公开 | 国际精品久久 | 97超碰在线免费 | av在线免费观看网址 | 亚洲精品二区 | 国产99久久精品一区二区300 | 欧美操操操 | 日韩精品一区二区三区中文在线 | 香蕉视频一区二区 | 日韩免费1区二区电影 | 黑人中文字幕一区二区三区 | 亚洲成av人片在线观看 | 欧美黄色网| 欧美精品一区在线观看 | 综合九九| 99re超碰| 国产一区二区三区视频 | julia中文字幕久久一区二区 | 久久麻豆精品 | 91高清在线观看 | 人人玩人人添人人澡欧美 | 亚洲视频一区二区三区 | 日韩专区中文字幕 | 在线午夜 | 色综合99| 中文字幕一区在线 | 日本中出视频 | 在线一级片 | 中文字幕99 | 亚洲精品视频播放 | 国产在线资源 | 国产日韩精品久久 | 中文字幕视频在线观看 | 国产中文字幕亚洲 | 成人免费视频网站在线看 | 国产精品欧美一区二区 |