Selenium Select2命令的下拉框 [英] Selenium Select2 command for drop-down box

查看:145
本文介绍了Selenium Select2命令的下拉框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Selenium的新功能,在我之前的问题中输入类型的Selenium IDE命令隐藏它正在使用select2,请帮助我使用下拉列表的选择选项命令.

am new to selenium and in my previous question Selenium IDE command for input type hidden it is using select2 please help me with the command to selection option for drop-down list.

我尝试在此处查看 https://gist.github.com/3683275 但它没有似乎不适合我

i tried looking in here https://gist.github.com/3683275 but it doesn't seem to work for me

mouseDown('//a[@class="select2-choice select2-default"][1]')
mouseUp('//li[contains(@class,"select2-result")][1]')

推荐答案

这些命令打开选项列表,等待其显示,最后选择标有加利福尼亚"的选项. Select2可以用不同的方式自定义,希望这些命令对您有用.

These commands open the options list, wait for it to appear, and finally choose the option labelled "California". Select2 can be customized in different ways, hope these commands work for you.

mouseDown      css=.select2-choice > div > b
waitForVisible css=.select2-results
mouseUp        css=.select2-result-label:contains('California') 

这篇关于Selenium Select2命令的下拉框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆