我希望我的量角器测试打开https://www.jetblue.com/并单击往返。下面是我为此编写的一段代码:
describe('This test suite will validate booking related features', function(){
beforeAll(function(){
browser.driver.manage().window().maximize();
browser.ignoreSynchronization=true;
browser.waitForAngularEnabled(false);
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
})
beforeEach(function(){
browser.get('https://www.jetblue.com/');
browser.getTitle().then(function(text){
console.log("Title of the page is : " +text);
});
});
it('Customer can search for Flights for One Way Trip', function(){
var AllElements = element.all(by.xpath("//label[text()=' One-way ']/parent::jb-radio"));
AllElements.each(function(ele){
ele.click();
browser.sleep(10000);
});
});
});
测试成功通过,无需选择单选按钮。我使用 Selenium-Java 使用相同的定位器,测试实际上是在执行操作并通过。让我觉得哪个更好,因为 Selenium-Java 在 Angular 应用程序上也同样有效。