我在phantomjs上执行selenium测试,我需要从下拉列表中选择一个项目 . 我尝试使用ID和类名来选择所需的项目 .
我也尝试过:
在测试中添加延迟 .
使用Selenium驱动程序的By.CssSelector方法 .
这是下拉按钮的代码:
<button class="btn btn-primary" id="btnNewTransformation" type="button" data-toggle="dropdown">
{{'imt_tranformation_action_title' | i18n}}
<span class="caret"></span>
</button>
以下是使用selenium驱动程序查找元素的代码:
s_driver.FindElement("//button[@id='btnNewTransformation']").Click();
我是新的硒和PhanomJS . 你能帮帮我吗?我在这里缺少什么,我应该尝试什么?