Get Commands
- Get commands are used to collect various information about the page that we deal with here are some important “get” commands.
1. Get-Command - get()
- get() command is used to open a new browser window and it will find/fetch the page that you have given.
2. Get Title Command - getTitle()
- getTitle() is used to get the title of the current page.
3. Get Current URL Command - getCurrentUrl()
- This command is used to get the current URL of the browser.
4. Get Page Source Command – getPageSource()
- This command is used to get the source code of the page.
5. Get Text – getText()
- This command is used to fetch the text of the element.
NAVIGATE COMMANDS
1. Navigate To Command– navigate().to()
- This command is like Get() command.
- It opens a new browser window and it will find/fetch the page that you have given.
2. Navigate Refresh Command– navigate().refresh()
- This command is used to refresh the current page.
3. Navigate to the back page– navigate().back()
- This command is used to go back by one page in the browser’s history.
4. Navigate to the forward page– navigate().forward()
- Takes you forward by one page on the browser’s history.
5. Refresh page – navigate().refresh()
- It refreshes the current page.
OTHER USEFUL COMMANDS
1. switch to command – ”
driver.switchTo().window(“windowName”) ”
- This command is used to switch from one window to another.
2. Switching from one iframe to another –
” driver.switchTo().frame(“frameName”) ”
- This command is used to switch from one iframe to another iframe.
3. Handling Alerts – ”
driver.switchTo().alert() ”
- This command is used to handle alerts.
4. Close Command – close()
- This command closes the current window of the browser.
5. Quit Command – quit()
- This command is used to quit the browser and all the opened windows in the browser.
No comments:
Post a Comment