我正在尝试使用量角器从下拉菜单中选择一个选项进行角度e2e测试。
这是select选项的代码片段:
<select id="locregion" class="create_select ng-pristine ng-invalid ng-invalid-required" required="" ng-disabled="organization.id !== undefined" ng-options="o.id as o.name for o in organizations" ng-model="organization.parent_id">
<option value="?" selected="selected"></option>
<option value="0">Ranjans Mobile Testing</option>
<option value="1">BeaverBox Testing</option>
<option value="2">BadgerBox</option>
<option value="3">CritterCase</option>
<option value="4">BoxLox</option>
<option value="5">BooBoBum</option>
</select>
我努力了:
ptor.findElement(protractor.By.css('select option:1')).click();
这给了我以下错误:
指定了无效或非法字符串Build info:版本:'2.35.0',修订版:'c916b9d',时间:'2013-08-12 15:42:01'系统信息:os.name:'Mac OS X' ,os.arch:'x86_64',os.version:'10 .9',java.version:'1.6.0_65'驱动程序信息:driver.version:未知
我也尝试过:
ptor.findElement(protractor.By.xpath('/html/body/div[2]/div/div[4]/div/div/div/div[3]/ng-include/div/div[2]/div/div/organization-form/form/div[2]/select/option[3]')).click();
这给了我以下错误:
ElementNotVisibleError:元素当前不可见,因此可能无法与命令持续时间或超时进行交互:9毫秒内部版本信息:版本:'2.35.0',修订版:'c916b9d',时间:'2013-08-12 15:42: 01'系统信息:操作系统名称:'Mac OS X',操作系统名称:'x86_64',操作系统版本:'10 .9',java.version:'1.6.0_65'会话ID:bdeb8088-d8ad-0f49-aad9 -82201c45c63f驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver功能[{platform = MAC,acceptSslCerts = true,javascriptEnabled = true,browserName = firefox,rotatable = false,locationContextEnabled = true,version = 24.0,cssSelectorsEnabled = true,databaseEnabled = true,handlesAlerts = true,browserConnectionEnabled = true,nativeEvents = false,webStorageEnabled = true,applicationCacheEnabled = false,takesScreenshot = true}]
任何人都可以帮助我解决这个问题,或者对我在这里做错的事情有所了解。