python - 在 python 下的 webdriver 2.4 中,用于 Select 对象的正确导入语句是什么?

标签 python testing selenium webdriver

我正在 python 2.7 上使用 selenium webdriver 2.4 编写测试。

文档 (http://seleniumhq.org/docs/03_webdriver.html) 演示了如下操作选择表单元素的能力:

Select select = new Select(driver.findElement(By.xpath("//select")));
select.deselectAll();
select.selectByVisibleText("Edam");

我需要像这样在 python 中操作选择表单元素。但是我不知道要导入什么才能成功实例化 Select 对象。

我的导入语句应该是什么?

谢谢。

最佳答案

However I cannot figure out what to import to successfully instantiate the Select object.

它可以作为: 从 selenium.webdriver.support.ui 导入选择

另请参阅:http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver_support/selenium.webdriver.support.select.html#module-selenium.webdriver.support.select

关于python - 在 python 下的 webdriver 2.4 中,用于 Select 对象的正确导入语句是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7601270/

相关文章:

python - OpenCV:完成后如何重新启动视频?

python - 实际数据未插入 MYSQL 数据库

python - 在 python、selenium 中,如何设置等待的错误消息?

java - 使用 ExpectedConditions 类断言元素不存在

python - 使用 Python 根据特殊字符将列表切片为嵌套列表

Python - 调试正在运行的应用程序

python - ValueError : Cannot assign "' assignee '": "Task. 受让人”必须是一个 "User"实例

testing - 测试IP代理的方法

unit-testing - t.Cleanup有什么用?

java - 无法使用 Selenium 单击div中弹出窗口的按钮