Debomita Bhattacharjee has Published 863 Articles

Reading JavaScript variables using Selenium WebDriver.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:27:47

3K+ Views

We can read Javascript variables with Selenium webdriver. Selenium can run Javascript commands with the help of executeScript method. The Javascript command to be executed is passed as an argument to the method. Also we have to add the statement import org.openqa.selenium.JavascriptExecutor to work with Javascript.SyntaxJavascriptExecutor j = (JavascriptExecutor) driver; j.executeScript("return document.title")Let ... Read More

How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:24:41

2K+ Views

We can capture the screenshot of a specific element rather than the entire page using Selenium webdriver. There may be requirements in the project where we have to capture the screenshot of a particular webelement.First of all we shall capture the screenshot of the entire page and then crop it ... Read More

Select parent element of known element in Selenium.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:22:49

15K+ Views

We can select the parent element of a known element with Selenium webdriver. First of all we have to identify the known element with the help of any of the locators like id, classname and so on. Then we have to identify its parent element with findElement(By.xpath()) method.We can identify ... Read More

Wait until page is loaded with Selenium WebDriver for Python.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:19:23

2K+ Views

We can wait until the page is loaded with Selenium webdriver. There is a synchronization concept in Selenium which describes implicit and explicit wait. To wait until the page is loaded we shall use the explicit wait concept.The explicit wait is designed such that it is dependent on the expected ... Read More

Running javascript in Selenium using Python.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:16:07

727 Views

We can run Javascript in Selenium webdriver with Python. The Document Object Model communicates with the elements on the page with the help of Javascript. Selenium executes the Javascript commands by taking the help of the execute_script method. The commands to be executed are passed as arguments to the method.Some ... Read More

How to handle windows file upload using Selenium WebDriver?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:14:04

3K+ Views

We can handle windows file upload with Selenium webdriver. This is achieved by the sendKeys method. We have to first identify the element which performs the file selection by mentioning the file path [to be uploaded].This is only applied to an element having a type attribute set to file as ... Read More

Scrolling to element using Webdriver.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:12:02

292 Views

We can perform scrolling to an element using Selenium webdriver. This can be achieved in multiple ways. Selenium cannot handle scrolling directly. It takes the help of the Javascript Executor and Actions class to do scrolling action.First of all we have to identify the element up to which we have to ... Read More

How do I set browser width and height in Selenium WebDriver?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:09:16

4K+ Views

We can set browser width and height in Selenium webdriver. There are multiple methods available to achieve this. Whenever an application is launched, it opens in its default browser size.We can resize the browser with the help of the Dimension class in Java. We create an object of the Dimension class ... Read More

Getting the return value of Javascript code in Selenium.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:04:17

4K+ Views

We can get the return value of Javascript code with Selenium webdriver. Selenium can run Javascript commands with the help of executeScript method. The Javascript command to be executed is passed as an argument to the method.We shall be returning the value from the Javascript code with the help of ... Read More

How to verify an XPath expression in Chrome Developers tool or Firefox's Firebug?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 26-Oct-2020 06:01:14

9K+ Views

We can verify an xpath expression in Chrome Developer tool or with Firefox Firebug. We can open the Developer tool in Chrome by pressing F12, then the Console tab is to be selected. We can validate the xpath with the $x("") expression.On clicking Enter after entering the expression, an array ... Read More

Advertisements