Articles on Trending Technologies

Technical articles with clear explanations and examples

What's the difference between RSpec and Cucumber in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 508 Views

The differences between RSpec and Cucumber are listed below −Sr. No.RSpecCucumber1A testing framework which gives the option to build and execute tests.A tool which is used to create test cases in plain English text.2Mainly used for integration and unit testing.Mainly used for user acceptance testing.3Utilized for Test Driven Development by developers and for Behavior Driven Development by testers.Utilized for Behavior Driven Development.4Narrates step from a business specification using the Describe, Context and It blocks.Narrates step from a business specification with the Given, When, Then, And, But, and so on keywords.5Code for implementation of a step is available within the Describe, ...

Read More

How can I verify Error Message on a webpage using Selenium Webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 9K+ Views

We can verify error messages on a webpage using Selenium webdriver using the Assertion. In case, the actual and expected values do not match, an Assertion Error is thrown.Let us try to verify the highlighted error message.Exampleimport 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.testng.Assert; public class VerifyErrorMsg{    public static void main(String[] args) {       System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");       WebDriver driver = new FirefoxDriver();       //implicit wait       driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);       //URL launch       driver.get("https://www.linkedin.com/");   ...

Read More

What is Selenium Internet Explorer Driver or IE Driver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 596 Views

Selenium Internet Explorer Driver is used to execute test cases in the Internet Explorer browser. It is a standalone server that establishes a link between our Selenium test and the Internet Explorer browser.We can download the Internet Explorer Driver file from the below link − https://www.selenium.dev/downloads/Select and click on the download link which is compatible with our local operating system. As the download is done successfully, a zip file gets created. We have to unzip it and save the executable file - IEDriverServer.exe in a location.Next, we shall set the path of the IEDriverServer.exe file using the System.setProperty method. We ...

Read More

C Sharp with Selenium - How to Switch one tab to another tab in Csharp Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 6K+ Views

We can switch one tab to another tab with Selenium webdriver in C#.Sometimes on clicking a link or a button, we can have multiple tabs opened in the same browser.By default, the webdriver can access only the parent tab. To access the second tab, we have to switch the driver focus with the help of the SwitchTo().Window() method. The window handle id of the tab where we want to switch to is passed as a parameter..The method CurrentWindowHandle yields the window handle id of the tab which is in focus. The WindowHandles method returns all the window handle ids of ...

Read More

How to set Page Load Timeout using C# using Selenium WebDriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 3K+ Views

We can set page load timeout using Selenium webdriver in C# using the PageLoad method. It is used to set time to wait for loading of the page. An exception will be thrown if the page is not loaded within the timeout specified.Syntaxdriver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(10);Here, 10 is the amount of time in seconds.Exampleusing NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System; using OpenQA.Selenium; namespace NUnitTestProject2{    public class Tests{       String url = "https://www.tutorialspoint.com/index.htm";       IWebDriver driver;       [SetUp]       public void Setup(){          //creating object of FirefoxDriver     ...

Read More

What are the different ways of handling authentication popup window using Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 993 Views

We can handle authentication pop-up window using Selenium webdriver by incorporating the username and password within the application URL. The format of an URL along with credential should be − https://username:password@URLLet us launch a web page having the authentication pop-up generated at page load −The user Name and Password fields are having value as admin.If we ignore this pop-up on clicking the Cancel button, we shall be navigated to the below page.If proper credentials are entered and then the OK button is clicked, we shall be navigated to the below page.In the above example, to handle the authentication pop-up, using ...

Read More

How can I get Webdriver Session ID in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 9K+ Views

We can get the webdriver session id with Selenium webdriver using the SessionId class. A session id is a distinctive number that is given to the webdriver by the server.This number is utilized by the webdriver to establish communication with the browser. The commands in our Selenium tests are directed to the browser with the help of this session id. The method getSessionId is used to obtain the webdriver session id.SyntaxSessionId s = ((RemoteWebDriver) driver).getSessionId();Exampleimport org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.remote.SessionId; import org.openqa.selenium.remote.RemoteWebDriver; public class BrwSessionId{    public static void main(String[] args) {       //set ...

Read More

How to avoid the pop-up window in chrome browser with Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 3K+ Views

We can avoid the pop-up window in Chrome browser with Selenium webdriver using the ChromeOptions class. We have to create an object of this class and apply the setExperimentalOption method to it. We shall create a Map and insert the below Chrome browser preference to it −profile.default_content_setting_values.notifications, and set its value to 2.The above browser preference shall be passed as a parameter to the method setExperimentalOption and finally added to the webdriver object.SyntaxMap pf = new HashMap(); pf.put("profile.default_content_setting_values.notifications", 2); ChromeOptions p = new ChromeOptions(); p.setExperimentalOption("prefs", pf);Exampleimport org.openqa.selenium.By; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import java.util.HashMap; import java.util.Map; import org.openqa.selenium.WebDriver; public class PopupDisable ...

Read More

How can I delete an element in Selenium using Python?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 8K+ Views

We can delete an element in Selenium webdriver using Python with the help of JavaScript Executor. Selenium is not capable of modifying the structure of DOM directly.It has the feature of injecting JavaScript into the webpage and changing the DOM with the help execute_script method. The JavaScript command to be used is passed as a parameter to this method.JavaScript command to delete an element is −var l = document.getElementsByClassName("tp-logo")[0]; l.parentNode.removeChild(l);The above script is to be passed as a parameter to the execute_script method.Let us try to remove the highlighted logo from the below page −Examplefrom selenium import webdriver #set chromodriver.exe ...

Read More

Selenium WebDriver: I want to overwrite value in field instead of appending to it with sendKeys using Java

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 2K+ Views

We can overwrite the value in the field instead of appending to it with sendKeys in Selenium webdriver. This can be done by using the Keys.chord method.It returns a string and can be applied to any web element with the help of the sendKeys method.To overwrite a value, we shall first select it with CTRL+A keys and then pass the new value. Thus, Keys.CONTROL, A and the new value are passed as parameters to the Keys.chord method.SyntaxString n = Keys.chord(Keys.CONTROL, "A"); WebElement l = driver.findElement(By.name("q")); l.sendKeys(n, "Tutorialspoint");Exampleimport 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 org.openqa.selenium.Keys; public class ...

Read More
Showing 49911–49920 of 61,299 articles
Advertisements