Found 719 Articles for Testing Tools

How To Use TestNG Framework For Creating Selenium Scripts?

Debomita Bhattacharjee
Updated on 29-Jun-2021 07:43:50

228 Views

We can use the TestNG framework for creating Selenium scripts. TestNG is a testing framework built for the usage of both the developers and testers. The steps to integrate TestNG with Selenium scripts are listed below −Step1 − Click on the Help menu from Eclipse. Then click on Eclipse Marketplace.Step 2 − In the Eclipse Marketplace pop-up, input TestNG within the Find field and click on Go. Then click on Install.Step 3 − Accept the license agreement radiobutton and then click on Finish.Step 4 − Click on the Restart Now button.Step5 − Click on the File menu, then click on ... Read More

How to Resize Browser Window in WebDriver?

Debomita Bhattacharjee
Updated on 29-Jun-2021 07:24:18

3K+ Views

We can resize the browser window in Selenium webdriver. We can configure the size of the browser with the help of the set_window_size method in Python.The dimensions of the window size are passed as parameters to this method. Again, to get the size of the browser, we can use the method get_window_size.Syntaxdriver.set_window_size(200, 500)ExampleCode Implementationfrom selenium import webdriver #set geckodriver.exe path driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") #maximize browser driver.maximize_window() #launch URL driver.get("https://www.tutorialspoint.com/index.htm") #new browser size driver.set_window_size(800, 880) #get window size print(driver.get_window_size()) #close browser driver.close()OutputRead More

Open New Browser Tab in Selenuim

Debomita Bhattacharjee
Updated on 29-Jun-2021 07:21:04

509 Views

Answer − We can open a new browser tab in Selenium webdriver. The methods - Keys.chord and sendKeys are required to achieve this task. The Keys.chord method is used to send multiple keys at once.We shall pass Keys.CONTROL and Keys.ENTER as parameters to this method. The complete string is again passed as a parameter to the sendKeys. Finally, the method sendKeys shall be applied on the link which we want to open in a new tabSyntaxString l = Keys.chord(Keys.CONTROL, Keys.ENTER); driver.findElement(By.xpath("//*[text()='Links']")). sendKeys(l);Code Implementationimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.Keys; public class OpenNewTab{    public static ... Read More

Selenium CSS Selectors Examples

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:21:19

666 Views

 We can locate elements with locator CSS Selector in Selenium webdriver. The general expression to create a CSS expression is tagname[attribute='value']. We can utilize the id and class attributes to create a CSS.With id, the syntax of a CSS expression is tagname#id. For instance, for a CSS expression - input#txt-loc, input is the tagname and the txt-loc is the value of the id attribute.With class name, the syntax of a CSS expression is tagname.class. For instance, for a CSS expression - input.txt-cls, input is the tagname and the txt-cls is the value of the class attribute.If there are n sub-elements(children) ... Read More

What are the various Components of Selenium?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:20:15

4K+ Views

There are various components of Selenium. It can work on multiple browsers like Chrome, Firefox, Safari, and so on. It also supports more than one operating system like Windows, Mac, Linux, and so on.The components of Selenium are listed below −Selenium IDE.Selenium RC.Selenium Webdriver.Selenium Grid.Selenium IDESelenium Integrated Development Environment is an important part of the Selenium suite. It was first developed as a Firefox plugin, however now it is available in both Firefox and Chrome browser.Some of the features of Selenium IDE −The recording, debugging and editing of the functional tests can be done in Selenium IDE.The scripts in Selenium ... Read More

Difference between find Element and find Elements in Selenium

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:50:16

4K+ Views

There are differences between findElement and findElements method in Selenium webdriver. Both of them can be used to locate elements on a webpage. The findElement points to a single element, while the findElements method returns a list of matching elements.The return type of findElements is a list but the return type of findElement is a WebElement. If there is no matching element, a NoSuchElementException is thrown by the findElement, however an empty list is returned by the findElements method.A good usage of findElements method usage is counting the total number of images or accessing each of images by iterating with ... Read More

Does cypress support api automation testing also?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:49:20

227 Views

Yes Cypress supports API automating testing also. XHR is known as the XML HTTP Request. It is an API which is used as an object. Its methods pass data between a server and browser. An XHR object can obtain data from a server in the form of a Response.Cypress can not only be used for UI automation, but can also be used to supervise the network traffic by directly acquiring the XHR objects. It is capable of mocking or stubbing a Response. An XHR information is obatined in the Network tab in the browser.XHR HeaderResponseTo trigger an XHR request, the ... Read More

Using the Selenium WebDriver - Unable to launch chrome browser on Mac

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:48:37

2K+ Views

While working with Selenium webdriver, we may be unable to launch the Chrome browser on Mac. However, it can be avoided by following the steps listed below −Step1 − Navigate to the link:https://sites.google.com/chromium.org/driver/ and click on the download link of the chromedriver version which is compatible with our local chrome browser.Step2 − Click on the chromedriver link available for the Mac operating system.Step3 − Once the download of the zip file gets completed, unzip it to get the chromedriver.exe file. Save it to a desired location.Step4 − While mentioning the path of the chromedriver.exe file in the System.setProperty method, we ... Read More

Is it possible to handle Windows based pop-ups in Selenium?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:47:33

4K+ Views

Yes, it is possible to handle Windows based pop-ups in Selenium webdriver. Sometimes on clicking a link or a button, another window gets opened. It can be a pop up with information or an advertisement.The methods getWindowHandles and getWindowHandle are used to handle child windows. The getWindowHandles method stores all the handle ids of the opened windows in the form of Set data structure.The getWindowHandle method stores the handle id of the window in focus. Since the getWindowHandles method holds all the opened window handle ids, we can iterate through these handle ids with the iterator and next methods.To switch ... Read More

What is difference between Assert and Verify in Selenium?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:45:55

3K+ Views

There are differences between Assert and Verify in Selenium. Both of these are used to verify if a webelement is available on the page. If the Assert fails, the test execution shall be stopped.The moment an Assertion has not passed in a step, the test steps after that step shall be hopped. However, this can be avoided by adding a try-catch block and incorporating the Assertion within this block.So the flow of the program execution continues if the Assertion yields a true condition. If not, the following steps after the failed step gets bypassed from the execution.To overcome this issue, ... Read More

Advertisements