如何在下拉量子器e2e测试中选择选项
我试图从下拉列表中选择使用量角器进行角度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();
这给了我以下错误:
指定了无效或非法字符串构建信息:版本:'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:unknown
我也尝试过:
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'系统信息:os.name:'Mac OS X',os.arch:'x86_64',os.version:'10 .9',java.version:'1.6.0_65'会话ID:bdeb8088-d8ad-0f49-aad9 -82201c45c63f驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform = MAC,acceptSslCerts = true,javascriptEnabled = true,browserName = firefox,rotating = false,locationContextEnabled = true,version = 24.0,cssSelectorsEnabled = true,databaseEnabled = true,handlesAlerts = true,browserConnectionEnabled = true,nativeEvents = false,webStorageEnabled = true,applicationCacheEnabled = false,takesScreenshot = true}]
任何人都可以帮我解决这个问题或者说明我在这里做错了什么。
相关分类