Debomita Bhattacharjee has Published 863 Articles

How to check if an image is displayed on page using Selenium?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:41:16

12K+ Views

We can check if an image is displayed on page with Selenium. To verify an image we shall take the help of Javascript Executor. We shall utilize executeScript method to execute the Javascript commands in Selenium.Then pass the command return arguments[0].complete && typeof arguments[0].naturalWidth != \"undefined\" && arguments[0].naturalWidth > 0 as a ... Read More

How to get innerHTML of whole page in selenium driver?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:37:50

2K+ Views

We can get the innerHTML of the whole page in Selenium. We shall use the method getPageSource and print the values captured by it in the console.SyntaxString s = driver.getPageSource();We can also get the HTML source code via Javascript commands in Selenium. We shall utilize executeScript method and pass the command return ... Read More

Getting console.log output from Firefox with Selenium.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:33:09

2K+ Views

We can get console.log output from Firefox with Selenium. This is done with the setProperty method.FirefoxDriver.SystemProperty.BROWSER_LOGFILE and the path of the file in which the logs are to be captured are passed as parameters to that method.SyntaxSystem.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "FFLogs.txt");After refreshing the project folder, we shall get the FFLogs.txt file where the ... Read More

Behind the scenes working of Selenium.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:31:02

214 Views

The behind scenes workings of Selenium is illustrated below −Source − https://www.tutorialspoint.com/what-is-web-driver-in-seleniumSelenium webdriver architecture comprises of −Selenium Binding Languages – It can used on multiple languages (Java, Ruby, Javascript, C#, Python, and so on). So it possesses the language bindings for multiple languages.JSON Wire Protocol – It is known as ... Read More

How do you test pages that require authentication with Selenium?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:26:55

408 Views

We can test pages that need authentication with Selenium. For this, we have to send the credentials of the user to the URL. Actually, we are passing both the username and password appended to the URL.Syntaxhttps://username:password@URL https://admin:admin@the-internet.herokuapp.com/basic_authHere, the admin is the username and password.URL – www.the-internet.herokuapp.com/basic_authLet us see how to ... Read More

How to use clickandwait in Selenium Webdriver using Java?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:24:42

2K+ Views

We can click and wait in Selenium. This can be achieved by the synchronization concept. We shall use the explicit wait condition and wait for an element to be clickable prior to the next step.The explicit wait waits for a specified amount of time before throwing an exception. To verify if ... Read More

How to connect to Chromium Headless using Selenium?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:21:59

474 Views

We can connect to Chromium headless with Selenium. The headless execution helps in reducing resource utilization and is a modern technique used in the industry.Chrome can be used in headless mode after the 59 version. The ChromeOptions class is used to change the default browser behavior. The headless value is passed ... Read More

How to get HTTP Response Code using Selenium WebDriver?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:16:29

6K+ Views

We can get an HTTP response code in Selenium webdriver. While running test cases, we can check the response code from a resource. Common HTTP response codes include −5XX – Issue in server.4XX – Resource cannot be determined.3XX - Redirection.2XX – Fine.An object of the class HttpURLConnection is created to ... Read More

How to Disable images in Selenium Google ChromeDriver?

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:13:43

784 Views

We can disable images in Selenium Google chromedriver. The images are disabled so that page load is quicker and execution time is also less. In chromedriver, we have to configure the below browser parameter −profile.managed_default_content_settings.images, and set its value to 2.Syntaxp.put("profile.managed_default_content_settings.images", 2);Let’s try to disable images from the below page ... Read More

Running Selenium Webdriver with a proxy in Python.

Debomita Bhattacharjee

Debomita Bhattacharjee

Updated on 28-Dec-2020 11:07:38

4K+ Views

We can run a proxy with Selenium webdriver in Python. A proxy is an essential component to do localization testing. We can take an e-commerce application and check if the language and currency visible is as per the user location.With the help of proxy within tests, we can verify if ... Read More

Advertisements