You may come across scenario's where you see elements on pages are loaded after some delay or after some specific event. In such a case, our scripts can fail and complain it cannot find the element. To tackle such scenario's we can have our script developed in such a way that it will wait for some predefined time before interacting with such type of elements We will stick to our earlier example of clicking Gmail link on google home page, here we assume Gmail link appears after some delay on the home page, below are the ways we can tackle this Sleeping till things appear on the page 😴 Yes. Sleeping till things get to normal. Assuming that Gmail link appears within 10 seconds after the page is loaded, we can sleep for 10 seconds before interacting with it, check below [ TestMethod ] public void Verify_Wait_Sleep() { ...
We have already discussed OOP in our first lecture of this course. Today we will talk about below 4 pillars of OOP Abstraction Encapsulation Inheritance Polymorphism Abstraction Abstraction is a concept aiming to hide relevant data about an object and expose a high-level mechanism for using it, which in turn increase efficiency and reduce complexity. For example, In Test Automation we use IWebDriver object for communication with the browser, we can open the URL and close the browser using available methods. Here we are not aware of how the communication with the browser is actually done. In Simple terms, IWebDriver object hides all the internal details and gives us methods for using it Below sample code IWebDriver driver = new ChromeDriver (); driver . Navigate() . GoToUrl( "https://www.google.com/" ); driver . Close(); Its ok, if you do not understand the code for now. We will talk about IWebdDriver i...
In this lecture, we will set up and start exploring the Webdriver API Let's commence Setting the stage I have created a new Unit test project called 'WebDriverCourse', which we will be used for WebDriver exploration lectures Right-click on the project -->Manage Nuget packages Click on Browse and search for Selenium.WebDriver and install same. Now you can see the project has reference to WebDriver DLLs under the reference section of the project. Below is the default unitTest.cs file which is autogenerated during project creation namespace WebDriverCourse { [ TestClass ] public class UnitTest1 { [ TestMethod ] public void TestMethod1 () { } ...
Comments
Post a Comment