├── .gitignore
├── java
├── pom.xml
└── src
│ └── test
│ └── java
│ └── lessons
│ ├── A_Drivers.java
│ ├── B_Navigation.java
│ ├── C_Locators.java
│ ├── D_Interactions.java
│ ├── E_Screenshots.java
│ ├── F_SelectElement.java
│ └── G_Waits.java
└── readme.md
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.war
8 | *.ear
9 |
10 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
11 | hs_err_pid*
12 |
13 | /.idea
14 | /java/.idea
15 | /java/target
16 | *.iml
--------------------------------------------------------------------------------
/java/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.friendlytesting.seleniumwebdriver
8 | seleniumwebdriverexamples
9 | 1.0-SNAPSHOT
10 |
11 |
12 |
13 | org.seleniumhq.selenium
14 | selenium-java
15 | 3.9.0
16 |
17 |
18 |
19 | junit
20 | junit
21 | 4.12
22 | test
23 |
24 |
25 |
26 | org.apache.directory.studio
27 | org.apache.commons.io
28 | 2.4
29 |
30 |
31 |
32 |
33 |
34 | 1.8
35 | 1.8
36 |
37 |
38 |
--------------------------------------------------------------------------------
/java/src/test/java/lessons/A_Drivers.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.junit.Test;
4 | import org.openqa.selenium.WebDriver;
5 | import org.openqa.selenium.chrome.ChromeDriver;
6 | import org.openqa.selenium.edge.EdgeDriver;
7 | import org.openqa.selenium.firefox.FirefoxDriver;
8 | import org.openqa.selenium.ie.InternetExplorerDriver;
9 | import org.openqa.selenium.safari.SafariDriver;
10 |
11 | public class A_Drivers
12 | {
13 | /**
14 | * If you run this test, after putting GeckoDriver in one of the locations mentioned, you should see Firefox open and close again.
15 | */
16 | @Test
17 | public void a_CreateFirefoxDriverGeckoDriverOnPath()
18 | {
19 | //This line will then create you a new Firefox driver instance.
20 | WebDriver driver = new FirefoxDriver();
21 | //This instructs Selenium to close the browser and kill the driver.
22 | driver.quit();
23 | }
24 |
25 | /**
26 | * Again if you run this test, Firefox will just open and close.
27 | */
28 | @Test
29 | public void a_CreateFirefoxDriverGeckoDriverUsingSystemProperty()
30 | {
31 | //This sets the property along with the specified value, change this for where you've put the driver
32 | System.setProperty("webdriver.gecko.driver", "/Users/richard/Downloads/geckodriver");
33 | WebDriver driver = new FirefoxDriver();
34 | driver.quit();
35 | }
36 |
37 | /**
38 | * If you run this test, after putting ChromeDriver in one of the locations mentioned, you should see Chrome open and close again.
39 | */
40 | @Test
41 | public void a_CreateChromeDriver()
42 | {
43 | //This line will create you a new instance of the ChromeDriver.
44 | WebDriver driver = new ChromeDriver();
45 |
46 |
47 |
48 | driver.quit();
49 | }
50 |
51 | /**
52 | * If you run this, you should see Safari open.
53 | */
54 | @Test
55 | public void a_CreateSafariDriver()
56 | {
57 | WebDriver driver = new SafariDriver();
58 | driver.quit();
59 | }
60 |
61 | /**
62 | * If you run this test, after putting MicrosoftWebDriver in one of the locations mentioned, you should see EDGE open and close again.
63 | */
64 | @Test
65 | public void a_CreateEdgeDriver()
66 | {
67 | System.setProperty("webdriver.edge.driver", "C:\\Users\\Richard\\Documents\\WebDriver\\MicrosoftWebDriver.exe");
68 | WebDriver driver = new EdgeDriver();
69 | driver.quit();
70 | }
71 |
72 | /**
73 | * If you run this test, after putting IEDriverServer.exe in one of the locations mentioned, you should see IE open and close again.
74 | */
75 | @Test
76 | public void a_CreateIEDriver()
77 | {
78 | System.setProperty("webdriver.ie.driver", "C:\\Users\\Richard\\Documents\\WebDriver\\IEDriverService.exe");
79 | WebDriver driver = new InternetExplorerDriver();
80 | driver.quit();
81 | }
82 |
83 | //There is a library you can use called WebDriverManager that will do all the setProperty stuff for you.
84 | //You can find that here - https://github.com/bonigarcia/webdrivermanager
85 | //But it's important for you to understand how it works, and not to blindly relay on libraries.
86 | }
--------------------------------------------------------------------------------
/java/src/test/java/lessons/B_Navigation.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.junit.Test;
4 | import org.openqa.selenium.WebDriver;
5 | import org.openqa.selenium.chrome.ChromeDriver;
6 |
7 | public class B_Navigation
8 | {
9 | @Test
10 | public void b_navigation() throws InterruptedException { //Explain InterruptedException
11 | //Start a new instance of Chrome
12 | WebDriver driver = new ChromeDriver();
13 |
14 | //We're going to look at manage() later in the course, but for now this line will maximise the browser window
15 | driver.manage().window().maximize();
16 |
17 | //Navigate to an awesome blog
18 | driver.navigate().to("https://www.thefriendlytester.co.uk");
19 | //We're using implicitWaits here just too help us see the navigation, please don't use these :D
20 | //We'll learn more about waits in later lessons
21 | Thread.sleep(2500);
22 | //Asking WebDriver to navigate to a different URL
23 | driver.navigate().to("https://thefriendlytester.co.uk/about");
24 | Thread.sleep(2500);
25 | //Asking WebDriver to press the back button on the browser
26 | driver.navigate().back();
27 | Thread.sleep(2500);
28 | //Asking WebDriver to press the forward button on the browser
29 | driver.navigate().forward();
30 | Thread.sleep(2500);
31 | //Asking WebDriver to refresh the current page
32 | driver.navigate().refresh();
33 |
34 | driver.quit();
35 | }
36 | }
--------------------------------------------------------------------------------
/java/src/test/java/lessons/C_Locators.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.junit.Test;
4 | import org.openqa.selenium.By;
5 | import org.openqa.selenium.WebDriver;
6 | import org.openqa.selenium.WebElement;
7 | import org.openqa.selenium.chrome.ChromeDriver;
8 |
9 | import java.util.List;
10 |
11 | public class C_Locators
12 | {
13 | /**
14 | * See if you can visit the URL below and understand why these selectors work.
15 | * This is how you find a single element.
16 | */
17 | @Test
18 | public void c_SingleElementAllLocators()
19 | {
20 | WebDriver driver = new ChromeDriver();
21 | driver.manage().window().maximize();
22 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
23 |
24 | //Find the Form using ID
25 | //The FindElement returns a WebElement object if it finds a match, we are assigning that to our own object called formById
26 | WebElement formById = driver.findElement(By.id("contactus"));
27 |
28 | //Find the same Form using Name
29 | WebElement formByName = driver.findElement(By.name("contactform"));
30 |
31 | //Find the Dropdown using it's class
32 | WebElement genderByClass = driver.findElement(By.className("gender"));
33 |
34 | //Find the only anchor link on the page
35 | WebElement linkByTag = driver.findElement(By.tagName("a"));
36 |
37 | //Find the first name input using an XPath from root
38 | WebElement firstNameFieldByFullXPath = driver.findElement(By.xpath("/html/body/main/article[1]/div[1]/form[1]/div[1]/div[1]/label[1]/input"));
39 |
40 | //Find the first name input using an XPath starting at the most unique parent
41 | WebElement firstNameFieldByShortXPath = driver.findElement(By.xpath("//*[@id=\"contactus\"]/div[1]/div[1]/label[1]/input"));
42 |
43 | //Find the anchor link using a CSS Selector
44 | WebElement linkUsingCSS = driver.findElement(By.cssSelector("div a"));
45 |
46 | //Find the policy link by it's text
47 | WebElement linkUsingLinkText = driver.findElement(By.linkText("Our Policy"));
48 |
49 | //Find the policy link using part of the links text
50 | WebElement linkByPartialText = driver.findElement(By.partialLinkText("Policy"));
51 |
52 | driver.quit();
53 | }
54 |
55 | /**
56 | * This is how you instruct WebDriver to find many elements from a single selector.
57 | * A use case for this could be to check how many links/inputs are on a page, be warned though it will return elements that are hidden
58 | */
59 | @Test
60 | public void MultipleElements()
61 | {
62 | WebDriver driver = new ChromeDriver();
63 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
64 |
65 | //The find elements method on the driver will return you a List of WebElements.
66 | //So we've created our own list called 'inputs' to assign the response from the driver.
67 | List inputs = driver.findElements(By.tagName("input"));
68 |
69 | //We can use all the locator methods above with FindElements.
70 |
71 | driver.quit();
72 | }
73 |
74 | /**
75 | * A common error you'll experience when using WebDriver is NoSuchElementException.
76 | * Selenium throws this error when it doesn't match any elements based on the locator you provided
77 | */
78 | @Test
79 | public void NoSuchElementExceptionExample()
80 | {
81 | WebDriver driver = new ChromeDriver();
82 | driver.manage().window().maximize();
83 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
84 |
85 | //So if you investigate the above page you'll see that there is no element with this ID, so it should throw an error
86 | WebElement ElementByID = driver.findElement(By.id("loginBox"));
87 |
88 | //So if you run this test, you will see the following error in the console
89 | //org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"loginBox"}
90 | //It's very well written error, and obvious to us what has gone wrong.
91 |
92 | driver.quit();
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/java/src/test/java/lessons/D_Interactions.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 | import org.openqa.selenium.By;
6 | import org.openqa.selenium.WebDriver;
7 | import org.openqa.selenium.WebElement;
8 | import org.openqa.selenium.chrome.ChromeDriver;
9 |
10 | public class D_Interactions
11 | {
12 | /**
13 | * Here are the basic interactions we can do with WebDriver on elements.
14 | */
15 | @Test
16 | public void d_SimpleInteractions()
17 | {
18 | WebDriver driver = new ChromeDriver();
19 | driver.manage().window().maximize();
20 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
21 |
22 | //We are going find a H2 element on the page, ask WebDriver to read it's text, and ask Java to write it to the console
23 | //getText() will read the all the text between the open and close tags of the element
24 | System.out.println(driver.findElement(By.tagName("h2")).getText());
25 |
26 | //We are going to find the First Name field, and ask WebDriver to enter 'Richard' into it
27 | //sendKeys() give us many options but for this stage, we are going to pass in the string 'Richard'
28 | driver.findElement(By.id("firstname")).sendKeys("richard");
29 |
30 | //We are going to ask WebDriver to read us the value within the Firstname field
31 | //We do this using getAttribute() we can actually be used to read any attribute of a HTML element
32 | System.out.println(driver.findElement(By.id("firstname")).getAttribute("value"));
33 |
34 | //In this line we are asking WebDriver to read the name attribute of the form element
35 | System.out.println(driver.findElement(By.id("contactus")).getAttribute("name"));
36 |
37 | //Click on the submit button, the one titled 'I do nothing!'
38 | //The click() method will attempt to click any element, but will only succeed if the element is visible.
39 | //WebDriver will scroll the page if needed in order to click a visible element
40 | driver.findElement(By.id("submitbutton")).click();
41 |
42 | driver.quit();
43 | }
44 |
45 | /**
46 | * There are also interactions we can do with the broswer
47 | * getCurrentUrl() we return you the URL in the address bar, can be could for verifying a flow took you to the right page
48 | * getTitle() will return you the title in the tab
49 | */
50 | @Test
51 | public void d_DriverInteractions()
52 | {
53 | //Start a Firefox Instance
54 | WebDriver driver = new ChromeDriver();
55 | driver.manage().window().maximize();
56 | //Navigate to a Website.
57 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
58 |
59 | //Read the url of the page.
60 | System.out.println(driver.getCurrentUrl());
61 | //Read the page title/tab title
62 | System.out.println(driver.getTitle());
63 |
64 | driver.quit();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/java/src/test/java/lessons/E_Screenshots.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.apache.commons.io.FileUtils;
4 | import org.junit.Test;
5 | import org.openqa.selenium.OutputType;
6 | import org.openqa.selenium.TakesScreenshot;
7 | import org.openqa.selenium.WebDriver;
8 | import org.openqa.selenium.chrome.ChromeDriver;
9 |
10 | import java.io.File;
11 | import java.io.IOException;
12 |
13 | public class E_Screenshots
14 | {
15 |
16 | @Test
17 | public void e_TakeAScreenshot() throws IOException
18 | {
19 | WebDriver driver = new ChromeDriver();
20 | driver.manage().window().maximize();
21 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
22 |
23 | //This code may look complicated, and based on what we've done so far, it is. But let's walk over it.
24 | //We start by creating a File object. This is object from the Java library. Basically a class representation of a file on your disk
25 | //We are then 'casting' our Driver on to the TakesScreenshot 'interface', which gives our Driver access to the getScreenshotAs() method
26 | //You can just accept this codes works, but I encourage you to explore casting and interfaces.
27 | File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
28 |
29 | //We now have a file on our machine, but it will be in some crazy place, you can do scrFile.getAbsolutePath() to find out where, but it doesn't really matter to us
30 | //What we'll do instead is make a copy of the file, and put in a directory we want it to be, along with a contextual name.
31 |
32 | //Here is how we do this on a Windows machine. We have to escape the \ by using \\
33 | //FileUtils.copyFile(scrFile, new File("C:\\Users\\IEUser\\Desktop\\locator_form.jpg"));
34 |
35 | //Mac
36 | FileUtils.copyFile(scrFile, new File("/Users/richard/Desktop/locator_form_firefox.jpg"));
37 |
38 | driver.quit();
39 | }
40 | }
--------------------------------------------------------------------------------
/java/src/test/java/lessons/F_SelectElement.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.junit.Test;
4 | import org.openqa.selenium.By;
5 | import org.openqa.selenium.WebDriver;
6 | import org.openqa.selenium.WebElement;
7 | import org.openqa.selenium.chrome.ChromeDriver;
8 | import org.openqa.selenium.support.ui.Select;
9 |
10 | import java.util.List;
11 |
12 | public class F_SelectElement
13 | {
14 |
15 | @Test
16 | public void f_SelectSingleOptionByText() {
17 | WebDriver driver = new ChromeDriver();
18 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
19 |
20 | //Create a new Select object called SelGender, we have to pass in a WebElement as a parameter.
21 | //We know from lesson 3 that findElement() returns a WebElement object, so we can pass that call as the parameter
22 | Select selGender = new Select(driver.findElement(By.id("gender")));
23 |
24 | //Ask WebDriver to see if there is an option with the text of 'My Business!'
25 | selGender.selectByVisibleText("My Business!");
26 |
27 | //Ask WebDriver to gather the text of the firsted selected option in the dropdown.
28 | //We know this select is NOT a multiple, so there will only be one selected, therefore it will return us the selected option.
29 | System.out.println(selGender.getFirstSelectedOption().getText());
30 |
31 | driver.quit();
32 | }
33 |
34 | @Test
35 | public void f_SelectSingleOptionByValue() {
36 | WebDriver driver = new ChromeDriver();
37 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
38 |
39 | Select selGender = new Select(driver.findElement(By.id("gender")));
40 |
41 | selGender.selectByValue("my_business");
42 | System.out.println(selGender.getFirstSelectedOption().getText());
43 |
44 | driver.quit();
45 | }
46 |
47 | @Test
48 | public void f_IsMultiple()
49 | {
50 | WebDriver Driver = new ChromeDriver();
51 | Driver.navigate().to("https://automationintesting.com/selenium/testpage");
52 |
53 | //If we visit the site above we can inspect the Gender dropdown and see it's not a multi-select
54 | //So we'll see false here
55 | Select selGender = new Select(Driver.findElement(By.id("gender")));
56 | System.out.println(selGender.isMultiple());
57 |
58 | //If you visit the site above and inspect the continent dropdown, you'll see it is a multi-select
59 | //So we'll see true here.
60 | Select selContinent = new Select(Driver.findElement(By.id("continent")));
61 | System.out.println(selContinent.isMultiple());
62 |
63 | Driver.quit();
64 | }
65 |
66 | @Test
67 | public void f_SelectMultipleOptions() {
68 | WebDriver driver = new ChromeDriver();
69 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
70 |
71 | Select selContinent = new Select(driver.findElement(By.id("continent")));
72 |
73 | //As we can see in the above check, we know continent is a multi-select, so let's select two options
74 | selContinent.selectByVisibleText("Africa");
75 | selContinent.selectByVisibleText("Europe");
76 |
77 | //As per the text guide for lesson, we know this will return all the selected option as WebElements
78 | //So we've created a List of WebElements and assigned the response to our list
79 | List selectedOptions= selContinent.getAllSelectedOptions();
80 |
81 | //This is a simple for loop in Java.
82 | //It basically means, for every WebElement in the list, execute this block of code.
83 | //First is the type, we then declare a name, the : means 'in', then our list.
84 | //So we are saying, for every selected option, get me the text.
85 | for (WebElement element : selectedOptions)
86 | {
87 | System.out.println(element.getText());
88 | }
89 |
90 | driver.quit();
91 | }
92 |
93 | @Test
94 | public void f_SelectMultipleOptionsDeselectSome() {
95 | WebDriver driver = new ChromeDriver();
96 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
97 |
98 | Select selContinent = new Select(driver.findElement(By.id("continent")));
99 |
100 | selContinent.selectByVisibleText("Africa");
101 | selContinent.selectByVisibleText("Europe");
102 | selContinent.selectByVisibleText("North America");
103 |
104 | //Select an option using it's value, not the visible text
105 | selContinent.selectByValue("south_america");
106 |
107 | //We've selected the above four options, so we should see those get printed to the console
108 | List selectedOptions= selContinent.getAllSelectedOptions();
109 | for (WebElement element : selectedOptions)
110 | {
111 | System.out.println(element.getText());
112 | }
113 |
114 | //Deselect an option using the visible text
115 | selContinent.deselectByVisibleText("Africa");
116 | //Deselect an option using the value
117 | selContinent.deselectByValue("north_america");
118 |
119 | //We should now see four results printed out
120 | List selectedOptionsNow = selContinent.getAllSelectedOptions();
121 | for (WebElement element : selectedOptionsNow)
122 | {
123 | System.out.println(element.getText());
124 | }
125 |
126 | driver.quit();
127 | }
128 | }
--------------------------------------------------------------------------------
/java/src/test/java/lessons/G_Waits.java:
--------------------------------------------------------------------------------
1 | package lessons;
2 |
3 | import org.junit.Test;
4 | import org.openqa.selenium.By;
5 | import org.openqa.selenium.WebDriver;
6 | import org.openqa.selenium.chrome.ChromeDriver;
7 | import org.openqa.selenium.support.ui.ExpectedConditions;
8 | import org.openqa.selenium.support.ui.FluentWait;
9 | import org.openqa.selenium.support.ui.Wait;
10 | import org.openqa.selenium.support.ui.WebDriverWait;
11 |
12 | import java.util.NoSuchElementException;
13 | import java.util.concurrent.TimeUnit;
14 | import java.util.function.Function;
15 |
16 | public class G_Waits
17 | {
18 | /**
19 | * This is bad. You want to do all you can to avoid this.
20 | * This is our first example if an implicit wait coded by us.
21 | * Here we are basically just telling Java to do absolutely nothing for 5 seconds.
22 | * However, we know what we are waiting for, or we should, so we should instead instruct Java on what to wait for.
23 | * But if you do ever want to tell Java to stop everything and do nothing for a period of time, this is how.
24 | */
25 | @Test
26 | public void g_ImplicitWait() throws InterruptedException {
27 | //First think you will see is the InterruptedException. We have to add this, as Thread.sleep() has the potential to throw this exception.
28 | //Therefore we need to handle it, or instruct our own code to throw the exception if it indeed happens.
29 |
30 | WebDriver driver = new ChromeDriver();
31 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
32 |
33 | //As mentioned above, this doesn't what you think. It sends your code to sleep for the provided value.
34 | //The value is in milliseconds. So 5000, is 5 seconds.
35 | Thread.sleep(5000);
36 |
37 | driver.quit();
38 | }
39 |
40 | /**
41 | * This isn't as bad, but it can be as bad. Just don't increase that 10 too high.
42 | * This is the overruling wait for WebDriver. WebDiver will continue to try each command to the server for this given time.
43 | * So in this check, we are going to the page and looking for an element I know doesn't exist on this page.
44 | * WebDriver will continue to look for it, for the provided time.
45 | */
46 | @Test
47 | public void g_ImplicitWaitDriverTimeout() throws InterruptedException {
48 |
49 | WebDriver driver = new ChromeDriver();
50 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
51 |
52 | //This tell WebDriver how long to keep trying a command for, until it gets a successful response.
53 | driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
54 |
55 | driver.findElement(By.id("ThisIsNotReal"));
56 | driver.quit();
57 | }
58 |
59 | /**
60 | * This is good. We like this.
61 | * This is an example of an Explicit Wait.
62 | * Which in other terms means, I'm willing to wait for this amount of time for the given command to be successful.
63 | * The moment the command is successful the check will progress.
64 | * The reason why this is preferred over implicit, is explicit waits are contextual. We can set different length waits depending on the apps behaviour
65 | */
66 | @Test
67 | public void g_ExplicitWaits()
68 | {
69 | //Start a Firefox Instance
70 | WebDriver driver = new ChromeDriver();
71 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
72 |
73 | //Selenium provide us with an object call WebDriverWait.
74 | //This object takes a Driver, and an int. That int is the amount of time to wait in seconds.
75 | WebDriverWait wait = new WebDriverWait(driver, 5);
76 |
77 | //We can set how often we want WebDriver to check if our condition is met
78 | wait.pollingEvery(250, TimeUnit.MILLISECONDS);
79 |
80 | //We can add a custom message. WebDriver will show this message if the wait times out.
81 | //A good contextual message here can really aid with debugging
82 | wait.withMessage("Timed out waiting for the password field");
83 |
84 | //So this check will eventually timeout. It will timeout after spending 5 seconds looking for an element with the ID of password.
85 | //The Selenium team have provided us with a huge range of ExpectedConditions.
86 | //If you type ExepectionConditions followed by a . intelliSense will show you all the options
87 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("password")));
88 |
89 | driver.quit();
90 | }
91 |
92 | /**
93 | * Now if we were to run this example, it would actually take 10 seconds to fail, even though our ExplicitWait is 5 seconds.
94 | * That's because we've set an ImplicitWait of 10 seconds.
95 | * This is why it's important to keep that global implicit wait, ideally at 0, but certainly no more than 2-3 seconds.
96 | * Now if the ExplicitWait was higher than the ImplicitWait, WebDriver would wait for the amount of time in the ExplicitWait.
97 | */
98 | @Test
99 | public void g_ExplicitWaitsWithImplicitWaits()
100 | {
101 | //Start a Firefox Instance
102 | WebDriver driver = new ChromeDriver();
103 | driver.navigate().to("https://automationintesting.com/selenium/testpage");
104 |
105 | driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
106 |
107 | WebDriverWait wait = new WebDriverWait(driver, 5);
108 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("password")));
109 |
110 | driver.quit();
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | Welcome to my Free Selenium WebDriver course repo.
2 |
3 | The text that supports this code and repo is available over at my [blog](https://thefriendlytester.co.uk/selenium/course/)
--------------------------------------------------------------------------------