In Selenium, all thoseĀ commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands like:
Actions– These commands directly interacts with the page elements like click, type etc.
Accessors– Allows to store the values.
Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium webdriver has a huge list of commands which are used for test automation which is performed by different operations.
They are:
1.Browser commands
2.Navigation commands
3. Webelements commands
1. BROWSER Commands:
a) Get command
This method opens a new webpage in existing browser. It accepts the parameter as string and returns void.
get(String arg0) : void
For example the command to load a website will be written as
Driver.get(āwww.google.comā)
Create a class browserFunctions in java and package and write the code to open the google webpage.
b) GetPageSource command:
Here the method returns the source code of present webpage loaded on the current browser this accepts no parameter and returns string value.
getPageSource(): String
driver.getPageSource();
or
String PageSource = driver.getPageSource();
c) GetCurrentURL command:
The job of this command is to fetch the string which represents the current URL of the current webpage. This command returns a string value.
getCurrentUrl(): String
For example, this command can be written as
driver.getCurrentUrl();
Or
String CurrentUrl = driver.getCurrentUrl();
d) Get title command:
This command fetches the title of the current webpage. This command accepts no parameter and returns a string.
getTitle(): String
For example this command can be written as
driver.getTitle();
OR
String Title = driver.getTitle();
e) Close command
The command is used to terminate the current browser window by operating by the webdriver at the current time. This method returns void.
close(): void
f) Quit command
This method terminates all the windows operating by the web driver. It closes the browser itself. This returns void.
quit(): void
For example this can be written as
driver.quit();
2. NAVIGATION commands:
- Navigate To
This method loads the new page in the current browser window. It returns nothing and accepts a string parameter.
to(String arg0) : void
for example it can be written as
driver.navigate().to(āWWW.H2KINFOSYS.COMā).
b) Navigate Forward
This method does the operation of clicking the forward button of any browser.It will not accept any parameter and not returns any value.
forward() : void
for example it is written as
driver.navigate().forward();
c) Navigate Back command
In this web driver this method simulates the browserās back button action. It will not allow any parameter and it returns void.
Driver. Navigate ().back ();
For example driver.navigate ().back();
d) Refresh command
This method works as to refresh the browser. It does not take any parameter and returns void.
driver.navigate().refresh();
For example driver.navigate().refresh();
3) WEB ELEMENTS COMMANDS:
a) Clear command
This method is used to clear the value of text type element. It will not accept any parameter and returns void.
WebElement user = driver.findElement(By.id(“User”));
user.clear();
b) Sendkeys command
This method prints the characters or values passed in the argument into the associated web element object.it will accept a char sequence as a parameter and its return type is void.
element.sendKeys(āenter textā);
for example:
WebElement user = driver.findElement(By.id("User"));
user.sendKeys(āTechBeamers");
c) Click command
The method does the click action at the web element; it will not accept any parameter and its return type is void.
element.click();
for example:
WebElement user = driver.findElement(By.id(āUser"));
booleanis displayed = user.isDisplayed();
d) GetText command
This method will give you the inner text value of the element and get Text () method may return a blank if the text is hidden.
element.getText();
for example
WebElement link = driver.findElement(By.xpath("MyLink"));
String strlink = link.getText();
8 Responses
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands:
. Actionsā These commands directly interacts with the page elements like click, type etc.
.Accessorsā Allows to store the values.
.Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium web driver has a huge list of commands which are used for test automation which is performed by different operations.
They are:
1.Browser commands
2.Navigation commands
3. Web elements commands
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands like:
Actionsā These commands directly interacts with the page elements like click, type etc.
Accessorsā Allows to store the values.
Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium web driver has a huge list of commands which are used for test automation which is performed by different operations.
They are:
1.Browser commands
2.Navigation commands
3. Web elements commands
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands like:
*Actionsā These commands directly interacts with the page elements like click, type etc.
*Accessorsā Allows to store the values.
*Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium webdriver has a huge list of commands which are used for test automation which is performed by different operations.
They are:
1.Browser commands
2. Navigation commands
3. Webelements commands
List of Selenium commands:
Commands are those which we perform some operations like open the window, get the browser or clear the text that have typed are controntrolled by some commands are called as Selenium commands.
There are three types of selenium commands:
1. Actions (These are directly use the web elements interfaces like click, type,etc.)
2. Accessors (Store the values)
3. Assertions: It asserts (If fails test stopped) and verifies (if fails, it results in logs of failure and execution wait for long time)
List of Selenium commands:
1. Browser commands (GetpageSource, GetTitle, GetCommand , Close , Quit)
2. Navigation Commands (Navigate to , NavigateForward , NavigateBackward , Refresh)
3. Web elements commands (Clear , Sendkeys , Click,GetText )
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands like:
Actionsā These commands directly interacts with the page elements like click, type etc.
Accessorsā Allows to store the values.
Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium webdriver has a huge list of commands which are used for test automation which is performed by different operations which are listed below:
1.Browser commands
2.Navigation commands
3. Webelements commands
1. BROWSER Commands:
a) Get command
b) GetPageSource command:
c) GetCurrentURL command:
d) Get title command:
e) Close command
f) Quit command
2. NAVIGATION commands:
a) Navigate Forward
b) Navigate Back command
c) Refresh command
3) WEB ELEMENTS COMMANDS:
a) Clear command
b) Sendkeys command
c) Click command
d) GetText command
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands:
. Actionsā These commands directly interacts with the page elements like click, type etc.
.Accessorsā Allows to store the values.
.Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium web driver has a huge list of commands which are used for test automation which is performed by different operations.
They are:
1.Browser commands
2.Navigation commands
3. Web elements commands
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands.
There are three types of commands like:
Actionsā These commands directly interacts with the page elements like click, type etc.
Accessorsā Allows to store the values.
Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution Wait For (waiting period).
Selenium webdriver has a huge list of commands which are used for test automation which is performed by different operations.
They are:
1.Browser commands
2.Navigation commands
3. Webelements commands
In Selenium, all those commands in which we perform certain operations like open a window, or we get a URL or we clear some text from the view are controlled by some commands these commands are called as selenium commands. There are three types of commands:
Actionsā These commands directly interact with the page elements like click, type, etc.
Accessorsā Allows storing the values.
Assertions- It asserts (when this commands fails, test stopped), verifies (when this fails, result logs the failure and continues with execution ),Wait For (waiting period).
Selenium web driver has a huge list of commands which are used for test automation which is performed by different operations. They are :
1.Browser commands
2.Navigation commands
3. Webelements commands