Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Selenium和Python选择具有unselectable=“on”属性的剑道下拉元素_Python_Selenium_Xpath_Css Selectors_Webdriverwait - Fatal编程技术网

如何使用Selenium和Python选择具有unselectable=“on”属性的剑道下拉元素

如何使用Selenium和Python选择具有unselectable=“on”属性的剑道下拉元素,python,selenium,xpath,css-selectors,webdriverwait,Python,Selenium,Xpath,Css Selectors,Webdriverwait,无法使用下面的代码选择剑道下拉列表。可以访问该站点以检查代码 要使用您在剑道下拉列表中选择文本为Chang的项目,您必须引导WebDriverWait使元素可点击,并且您可以使用以下任一选项: 使用CSS_选择器: 使用XPATH: 注意:您必须添加以下导入: from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdr

无法使用下面的代码选择剑道下拉列表。可以访问该站点以检查代码


要使用您在剑道下拉列表中选择文本为Chang的项目,您必须引导WebDriverWait使元素可点击,并且您可以使用以下任一选项:

使用CSS_选择器:

使用XPATH:

注意:您必须添加以下导入:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
浏览器快照:

要在剑道下拉列表中使用“你”选择文本为“改变”的项目,你必须引导WebDriverWait使元素可点击,并且你可以使用以下任一选项:

使用CSS_选择器:

使用XPATH:

注意:您必须添加以下导入:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
浏览器快照:

它的作品,是否有使用python selenium的剑道控件复选框、多选、网格等文档?谢谢你advance@Vignesh我不确定是否有任何具体的文档,但如果您提出了问题,我想看看。我们如何通过dropdpwn list id进行选择?因为当我们在html中进行更改时,xpath或css选择器会发生更改,并且需要在测试用例代码中更新xpath或css选择器。处理这种情况的有效方法是什么?它的工作原理,是否有使用python selenium的剑道控件复选框、多选、网格等文档?谢谢你advance@Vignesh我不确定是否有任何具体的文档,但如果您提出了问题,我想看看。我们如何通过dropdpwn list id进行选择?因为当我们在html中进行更改时,xpath或css选择器会发生更改,并且需要在测试用例代码中更新xpath或css选择器。处理这种情况的有效方法是什么?
driver.get("https://demos.telerik.com/kendo-ui/dropdownlist/remotedatasource")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//span[@class='k-widget k-dropdown' and @aria-owns='products_listbox']"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='k-animation-container']/div[@id='products-list']//ul//li[text()='Chang']"))).click()
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC