![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 871 Articles for Automation Testing
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
10K+ Views
We can navigate back in the browser with Selenium webdriver. There are multiple ways to achieve this. The back() method is used to move back to the prior browser page. This method only is applicable if we jump from webpage to another.We can also move back in the browser with the help of a Javascript Executor in Selenium. It has the execute_script() method which allows Selenium to run Javascript commands. We have to execute the Javascript command window.history.go(-1) to go back to the previous page.Examplefrom selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") driver.implicitly_wait(0.5) #launch a webpage driver.get("https://www.tutorialspoint.com/about/about_careers.htm") print("Current Page title: ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
12K+ Views
We can get the value of a HTML input with Selenium webdriver. This is achieved with the help of the getAttribute() method. To retrieve the value of the field with tagname input, we have to pass the value as parameter to the getAttribute() method.Let us consider an html code for a html input.We have no value attribute for the field in the DOM. However we shall get the field value as displayed with getAttribute() method.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class InputVal{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
6K+ Views
We can hold a key down with Selenium webdriver. We mostly utilize the CONTROL/SHIFT/ALT keys to hold down and then click on other keys. So, only mentioning the modifier keys like keys.CONTROL/ keys.SHIFT or Keys.ALT is not sufficient.To hold down a key simultaneously while another key is being pressed, we use the keyDown() and keyUp() methods. Both these methods accept the modifier key as a parameter.The action of these two methods on a key yields a special functionality of a key. All these methods are a part of Actions class in Selenium. We have to add the import org.openqa.selenium.interactions.Actions package ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
19K+ Views
We can perform key press of (CTRL+A) with Selenium Webdriver. There are multiple ways to do this. We can use the Keys.chord() method to simulate this keyboard action.The Keys.chord() method helps to press multiple keys simultaneously. It accepts the sequence of keys or strings as a parameter to the method. To press CTRL+A, it takes, Keys.CONTROL, "a" as parameters.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class PressCtrlA{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/index.htm"; ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
1K+ Views
We can find elements inside form and iframe with Selenium webdriver. A form in an html document is represented by atag. A form may contain multiple elements inside it. A form can be submitted with a submit() or a click() method.Let us see a form with fields email and password.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class FormElements{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.linkedin.com/"; driver.get(url); driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS); // ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
555 Views
We can perform right click using Selenium ChromeDriver. On right clicking on a webelement, the context menu gets displayed. For example, if we right click on a text area, an additional menu with several options come up.Actions class in Selenium is responsible for simulating this mouse operation. The Actions class provides the contextClick() method to carry out this action and select any option from the context menu.To perform this entire operation, we shall first move the mouse to the middle of the element with moveToElement() method, then apply contextClick() method. Furthermore, we have to execute the build() method to execute the ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
3K+ Views
We can find specific lines in a table with Selenium webdriver. A table is identified in an html document with tag. Each table comprises a tag that represents rows and a tag to represent columns. To traverse through table rows and columns we use the method findElements().To count the total number of rows in table we use size() method available for list −List l=driver.findElements(By.tagName("tr")); int s= l.size();To count the total number of columns in table we use size() method available for list −List m=driver.findElements(By.tagName("td")); int t= m.size();Let us consider the below table and get the ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
589 Views
We can click on an element using javascript, Actions class and webdriver methods. Selenium can execute commands in Javascript with the help of the execute_script() method.We have to import org.openqa.selenium.JavascriptExecutor in our code to work with a javascript executor. In order to click an element, first we have to move to that element with mouse movements. We can execute mouse movement with the help of the Actions class in Selenium.We have to use the moveToElement() method. This method shall perform mouse movement till the middle of the element and then perform click followed by build() and perform() methods. We have ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
17K+ Views
We can find and click elements by title in Selenium webdriver. An element can be identified with a title attribute with xpath or css selector. With the xpath, the expression should be //tagname[@title='value']. In css, the expression should be tagname[title='value'].Let us take an html code for an element with a title attribute.The xpath to identify the element should be //a[@title='Tutorialspoint'] and the css expression should be a[title='Tutorialspoint']. Once the element is identified we can use the click() method for clicking on it.ExampleCode Implementation.from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # implicit wait for 5 seconds driver.implicitly_wait(5) # maximize with ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
27K+ Views
We can wait until an element is present in Selenium Webdriver. This can be done with the help of synchronization concept. We have an explicit wait condition where we can pause or wait for an element before proceeding to the next step.The explicit wait waits for a specific amount of time before throwing an exception. To verify if an element is present, we can use the expected condition presenceOfElementLocated.ExampleCode Implementation.import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class ElementPresenceWait{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); ... Read More