Found 719 Articles for Testing Tools

Selenium Webdriver submit() vs click().

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:36:08

9K+ Views

The click() and submit() functions are quite similar in terms of functionalities. However there are minor differences. Let us discuss some differences between them.The submit() function is applicable only for and makes handling of form easier. It can be used with any element inside a form. The click() is only applicable to buttons with type submit in a form.The submit() function shall wait for the page to load however the click() waits only if any explicit wait condition is provided. If a form has a submit of type button, the submit() method cannot be used. Also, if a button ... Read More

Fill username and password using selenium in python.

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:32:40

2K+ Views

We can fill username and password fields in a login page with Selenium. This is considered an authentication step for any application. Once the username and password is entered, we have to click the login button.ExampleCode Implementation.import time from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") driver.get("https://mail.rediff.com/cgi-bin/login.cgi") # identify username, password and signin elements driver.find_element_by_name("login").send_keys("tutorialspoint") time.sleep(0.2) driver.find_element_by_name("passwd").send_keys("pass123") time.sleep(0.4) driver.find_element_by_class_name("signinbtn").click() driver.closeIf a valid username and password is provided, we shall be directed to the home page of the application.OutputRead More

Test if element is present using Selenium WebDriver?

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:31:00

4K+ Views

We can verify if an element is present using Selenium. This can be determined with the help of findElements() method. It returns the list of elements matching the locator we passed as an argument to that method.In case there is no matching element, an empty list [having size = 0] will be returned. We are not using the findElement() method since if there is no matching element, this method gives NoSuchElementException.In an event of any exception, we have to handle it with a try catch block.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 java.util.List; public class ... Read More

How to take partial screenshot (frame) with Selenium WebDriver?

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:27:47

387 Views

Whenever we encounter a failure during testing, it is a common nature to capture the screenshots wherever there is a deviation from the expected result. Thus it is considered a mandatory step to attach a screenshot for creating a bug.While automating a bunch of test cases of a considerable number, capturing screenshot is critical to infer why a test case has failed for both the development and testing team. As they debug the failures, going through the screenshot and conclude if the failure is due to script issue or defect in the application.Sometimes we may need to capture the screenshot ... Read More

How to automate drag & drop functionality using Selenium WebDriver Java?

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:25:06

511 Views

The drag and drop action is done with the help of a mouse. It happens when we drag and then place an element from one place to another. This is a common scenario when we try to move a file from one folder to another by simply drag and drop action.Selenium uses the Actions class to perform the drag drop action. The dragAndDrop(source, destination) is a method under Actions class to do drag and drop operation. The method will first do a left click on the element, then continue the click to hold the source element. Next it shall move ... Read More

How can I scroll a web page using selenium webdriver in python?

Debomita Bhattacharjee
Updated on 16-Feb-2021 06:49:03

2K+ Views

Sometimes we need to perform action on an element which is not present in the viewable area of the page. We need to scroll down to the page in order to reach that element.Selenium cannot perform scrolling action directly. This can be achieved with the help of Javascript Executor and Actions class in Selenium. DOM can work on all elements on the web page with the help of Javascript.Selenium can execute commands in Javascript with the help of the execute_script() method. For the Javascript solution, we have to pass true value to the method scrollIntoView() to identify the object below ... Read More

How to perform mouseover function in Selenium WebDriver using Java?

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:20:57

686 Views

A mouse hover is done on an element to fire an event on that element. If we hover on the menus of a webpage the submenus appears. Thus this event gets triggered on hovering on an element.It is evident from the above image that on hovering over the Packages menu the color of the text changed along with the tooltip display. Selenium has the Actions class that contains multiple APIs for mouse cursor movement.The moveToElement() method is used to perform mouse movement. We have to import org.openqa.selenium.interactions.Actions for Action class. Along with moveToElement() we have to use the perform() method ... Read More

How do I find an element that contains specific text in Selenium Webdriver?

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:18:35

1K+ Views

We can find an element with a specific text visible on the screen in Selenium. This is achieved with the xpath locator. The xpath locator contains some in-built functions that help to create customized xpath.Let us consider a portion of the web page as given below −text() − It is a built in function to identify an element based on the text displayed on the screen. For example, if we want to identify Library from the above webpage, the customized xpath with text() should be −Syntax//*[text()='Library']contains() − It is a built in function to identify an element based on the ... Read More

Scroll Element into View with Selenium.

Debomita Bhattacharjee
Updated on 31-Oct-2023 03:48:50

21K+ Views

We may need to perform action on an element which is not present in the viewable area of the page. We need to scroll down to the page in order to reach that element.Selenium cannot perform scrolling action directly. This can be achieved with the help of Javascript Executor and Actions class in Selenium. DOM can work on all elements on the web page with the help of Javascript.Selenium can execute commands in Javascript with the help of the execute_script() method. For the Javascript solution, we have to pass true value to the method scrollIntoView() to identify the object below ... Read More

How to take screenshot with Selenium WebDriver?

Debomita Bhattacharjee
Updated on 28-Aug-2020 06:09:49

2K+ Views

Whenever we encounter a failure during testing, it is a common nature to capture the screenshots wherever there is a deviation from the expected result. Thus it is considered a mandatory step to attach a screenshot for creating a bug.While automating a bunch of test cases of a considerable number, capturing screenshot is critical to infer why a test case has failed for both the development and testing team. As they debug the failures, going through the screenshot and conclude if the failure is due to script issue or defect in the application.Let us discuss which part of the page ... Read More

Advertisements