本文整理匯總了TypeScript中protractor/globals.browser.driver.findElement方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript browser.driver.findElement方法的具體用法?TypeScript browser.driver.findElement怎麽用?TypeScript browser.driver.findElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類protractor/globals.browser.driver
的用法示例。
在下文中一共展示了browser.driver.findElement方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should log in', () => {
// Check browser url (root)
expect(browser.driver.getCurrentUrl()).toMatch('/');
// Find form elements (login modal is already opened)
var userNameField = browser.driver.findElement(by.id('email'));
var userPassField = browser.driver.findElement(by.id('password'));
// Fill input fields
userNameField.sendKeys(userEmail);
userPassField.sendKeys(userPass);
// Ensure fields contain what has been entered
expect(userNameField.getAttribute('value')).toEqual(userEmail);
expect(userPassField.getAttribute('value')).toEqual(userPass);
browser.driver.findElement(by.id('log-in-btn')).then(function(loginBtn) {
// Click to log in - waiting for Angular as it is manually bootstrapped.
loginBtn.click().then(function() {
browser.waitForAngular();
// Browser url must have changed to the dashboard route
expect(browser.driver.getCurrentUrl()).toMatch('/courses');
});
});
});
示例2: expect
btn.click().then(function() {
page.waitUntilElementPresent('#course-details-modal');
// Find form elements
var entryTitleField = browser.driver.findElement(by.css('input#inputTitle'));
var entryCommentField = browser.driver.findElement(by.css('textarea#inputComment'));
// Fill input fields
entryTitleField.sendKeys('New testing entry title');
entryCommentField.sendKeys('New testing entry comment');
// Ensure fields contain what has been entered
expect(entryTitleField.getAttribute('value')).toEqual('New testing entry title');
expect(entryCommentField.getAttribute('value')).toEqual('New testing entry comment');
// Send new entry
browser.driver.findElement(by.css('#post-modal-btn')).then(function(sendButton) {
sendButton.click().then(function() {
browser.waitForAngular();
page.waitUntilElementNotVisible('#course-details-modal');
// Get and check the title of last entry
var entries = element.all(by.css('li.entry-title div div a'));
expect(entries.last().getText()).toContain('New testing entry title');
});
});
});
示例3:
browser.driver.findElement(by.css('label[for=delete-checkbox]')).then(function(activationAllowed) {
activationAllowed.click();
// Get and click the button to activate the forum
browser.driver.findElement(by.css('#put-modal-btn')).then(function(activateButton) {
activateButton.click().then(function() {
browser.waitForAngular();
page.waitForAnimation();
page.waitUntilElementPresent('#add-entry-icon');
});
});
});