Skip to main content

Posts

Featured post

Selenium -How to select a value in dropdown

Recent posts

Page Factory Design Pattern

In Selenium 'Page factory Design Pattern' is Extensive and Enhanced Version of Page Object Model(POM) , Page Factory pattern is used to initialize web elements which are defined in Page Objects. How Elements are identified in Page Factory Design Pattern ? @FindBy annotation is used to Identify Elements in Page Factory ,Annotations supports all 8 Type of Selenium Locators (id, name, className, css, xpath, tagName, linkText and partialLinkText) There is two ways to use this annotation. 1. By 'How' @FindBy(how = How.LocatorName, using = "Value") private WebElement ElementName; Ex- @FindBy(how = How.ID, using = "password") private WebElement Password; 2. By Direct Locator name @FindBy(LocatorName="Value") private WebElement ElementName; Ex- @FindBy(id="password") private WebElement Password; For Multiple Elements Handlng(List of WebElements) Ex- @FindBy(tagName = "mylist") private List<WebElemen

How to Open a Link in New Tab in Selenium

In this Example, we will open a link in New tab, So below mentioned step you have to perform to achieve this : 1. Create an XPath or find a unique path of the link. Ex : As Mentioned in ScreenShot we are going to open a 'CORE JAVA' Link in new Tab So we have taken a Unique Path. Image 1 2. Get 'href ' Attribute from WebElement, because of Every Link Consist of a Unique URL String UrlofLink = driver.findElement(By.xpath("//a[contains(text(),'Core Java')]")).getAttribute("href"); or you can Devide Script into Two Parts WebElement Link = driver.findElement(By.xpath("//a[contains(text(),'Core Java')]")); String UrlofLink=Link.getAttribute("href"); 3. To Open a New Tab you have to use JavaScript Executor and WindowHandler, JavaScriptExecutor has Used for Open a Blank new Tab and Through windowHandler, you will get a count of current Tab based

Locators in Selenium

Locators  Locators provide a mechanism to access the HTML elements on a web page. Once we locate an element/object on any web page, Then to get or store the Webelement we use findElement() or Findelements()  method to find or strore the located webelement or List of elements then we can write test cases to execute on them.                                                                                               OR Selenium uses what is called locators to find and match the elements of your page that it needs to interact with                            For example, If we would like click on any button then locators will help me to click on button , We will see that in details in the subsequent sections of this tutorial. Types of Locators in Selenium  Selenium webdriver Have 8 locators to find the Web elements on web page , We have mentioned the list of locators as per priority to be used while Coding. ID Name  Link Text Partial Link Text Tag Name  Class Name

Configuration of Selenium WebDriver Project With Java part 2

In Last Article we have seen that what different stuff required for Maven Project and Java Project Configuration  ,In this article we will learn about final configuration of Selenium WebDriver Project  Download The Latest Version of Selenium Standalone Jar   Selenium Standalone Server Latest Version   for Java Project and or Copy Selenium Dependency for Maven Project - This Step we have Completed in Previous Article  . Download Chrome Driver  Latest version  Chrome Driver Latest Version  as Per Your System Configuration for both Maven and Java Project  Open your Prefered IDE  Eclipse IDE  ,IntelliJ IDEA Create a Java Project or Maven Project if You want to work on Existing Project then Skip this Step ,otherwise i prefer to create Setup in New Project ,if You do not How To create Simple Java Project Click Here Right click on  Java/Maven Project  >New >Folder > Enter Folder Name Like -'Jar' >Click on Finish For Java Project -Copy Selenium Standal

Configuration of Selenium WebDriver Project With Java part 1

To install Selenium means to set up a project in a development so you can write a program using Selenium. How you do this depends on your programming language and your development environment and Selenium is Language Independent Tool So You can use any one Programming Language among -  Java , C# , Python , Ruby , PHP , JavaScript , Perl . Java  The easiest way to set up a Selenium 2.0 Java project is to use Maven. Maven will download the java bindings (the Selenium 2.0 java client library) and all its dependencies, and will create the project for you, using a maven pom.xml (project configuration) file. Once you’ve done this, you can import the maven project into your preferred IDE, IntelliJ IDEA or Eclipse .    Maven Project             For Maven Project you Should have Selenium Dependency in POM.xml ,Selenium Dependency you can get from Here . <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> <dependency> <groupId>org.se

Introducing Selenium WebDriver

The primary new feature in Selenium Webdriver 2.0 is the integration of the WebDriver API. WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API. Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems. WebDriver Compared to Selenium-RC Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using. Information on each ‘browser driver’ is provided later in this chapter. For those familiar with Selenium-RC, this is quite different from what you are used to. Selenium-RC worked the same way for each supported browser