-
Notifications
You must be signed in to change notification settings - Fork 0
06 Global Variables
Biswajit Sundara edited this page Feb 23, 2021
·
3 revisions
When we talk about automating the web application. There are basically two initial steps start the browser and locate the element before performing any action. Protractor API has made browser and element objects as global and its directly imported to the spec file.
-
browseris a global variable in Protractor API - We don't have to do anything, just use browser in the
itblock and Protractor recognizes it as the browser driver - If you are wondering, how can we set which browser to use then that's handled in
conf.jssettings - This is like
driverobject of selenium -
Example:
browser.get('https://')to open any URL
-
elementis a global variable in Protractor API - It's a helper function for finding and interacting with DOM elements of the page.
- The function uses locator strategy as the argument
- This is like
findElementof selenium -
Example:
element(by.css('a'))
-
byis a global variable in Protractor API - It's a collection of locator strategies to identify elements in DOM
-
Example:
element(by.id('uname'))