Error encountered in main thread: org.openqa.selenium.WebDriverException - an unexpected error occurred: net::ERR_CONNECTION_CLOSED

I'm new to QA and I recently attempted to automate for the first time using Microsoft Edge Version 109.0.1518.61. Unfortunately, I encountered these errors: Here is the first error, and here is the second error.

  • SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  • SLF4J: Defaulting to no-operation (NOP) logger implementation
  • SLF4J: See for further details.
  • Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_CLOSED

The project is set up as a maven project and there are no errors in the code blocks provided. The complete code block is shown below:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;

public class BrowserTest {

    public static void main(String[] args) {
        
        EdgeOptions options = new EdgeOptions();
        options.addArguments("edge.switches","--disable-extensions");
        WebDriver Driver = new EdgeDriver(options);
        
        Driver.get("https://seleniumhq.org/");
    }

}

Answer №1

The mistake can be found in the line below:

Driver.get("https://seleniumhq.org/");

This issue arises when the URL you are attempting to reach is inaccessible, blocked by a proxy, or similar. If you are open to using a different URL, consider trying out the following code:

Driver.get("https://www.selenium.dev/");

Additionally, it's recommended to adhere to Java standard naming conventions. For instance, the variable Driver should be written as driver.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Disabling "Unresponsive script" alerts in Selenium and Firefox: What is the best approach?

Currently, I am utilizing Selenium Client 2.4.0 on Mac 10.6.6 with Firefox 5. When using the WebBackedSeleniumDriver, a "selenium.getEval" command triggers a warning in Firefox: "Warning: Unresponsive script. A script on this page may be busy, or it may ...

Issue with clicking Selenium button using button.click() not resolved

Recently, I attempted to load a page and click on a button, but it seems that something is going wrong. I used to be familiar with these tasks, but the new update in Selenium has made things more challenging now. Below is the code snippet: import selenium ...

Upon inputting a video title in the designated variable, the vidplayer() function fails to find the specified video and instead plays a random video from YouTube

I'm currently working on creating a user-friendly GUI where I can input the title of a video. Upon clicking a button, a Selenium function (vidplayer) will locate the video on YouTube and play the first one from the search results. Everything is functi ...

What is causing the inability to interact with a button using Selenium?

While attempting to automate the selection of a dining date using Selenium on a particular website, I encountered an issue with my code: driver = webdriver.Chrome('/Users/agneschang/Downloads/chromedriver') driver.get('https://inline.app/boo ...

What are the steps to incorporate selenium webdriver methods into the robot framework library?

I am looking to incorporate Selenium webdriver methods into my robot framework library. def custom_go_to driver = BuiltIn().get_library_instance('SeleniumLibrary') driver.go_to(url) The code above, from my custom library, functi ...

"Utilize the power of PhantomJS to interact with checkboxes through

I am currently utilizing Selenium and PhantomJS to navigate web pages and I would like to learn the proper technique for clicking a checkbox. For instance, on this specific page: My goal is to select the "Free Courses" checkbox, so I attempted the followi ...

Unable to physically tap on the checkbox input, though able to perceive the value it holds

When running my protractor test, I encountered an issue with the following statement: await element(by.model('publishCtrl.isPublishedInAllRegions')).click(); The test failed and returned an error message stating "ElementNotVisibleError: element ...

Problems with locating elements in Selenium

There seems to be a problem with identifying the button element in the HTML code snippet provided below. I have tried multiple methods but have not been successful in targeting it accurately. Despite confirming that it is not located within an iframe, my ...

Is there a way to confirm the authenticity of the downloaded image through Selenium IDE?

<img id="imgCoverImage" class="imgCoverImg" alt="cover image" src="http://ecx.images-amazon.com/images/I/51IH3D6kpSL._SL160_.jpg"> I've inserted a cover image of a book onto my website. Now I'm trying to confirm the presence of this image ...

Setting the max.retries system property in Thucydides: A step-by-step guide

Could someone provide instructions on how to set the system property max.retries in Thucydides? I want to be able to rerun failed tests in Thudcydies using the max.retries feature. Any guidance on how to do this would be greatly appreciated. ...

"Encountering a runtime error 438 in VBA while using Selenium

Currently, I am delving into the world of Selenium VBA, eager to harness the power of HideCommandPromptwindow in Selenium VBA. Unfortunately, when attempting to implement the code below, I encountered a dreaded runtime-error 438. HideCommandPromptWindo ...

Using a Spring Exception Handler to return a JSON response

I have implemented the following Spring code to handle exceptions and return responses to clients. Even though I used the ResponseBody annotation, I expected Spring to return a JSON response directly to the client in case of an error. However, the response ...

Can multiple instances of a program be launched simultaneously?

As part of an educational project, I am developing a Python bot that creates Twitter accounts using disposable email addresses (catchalls) and Russian phone numbers. Successfully passing both the email and phone verification stages piqued my interest in sc ...

Retrieving real-time CDATA from a webpage with the help of Selenium

Attempting to download the complete HTML content from all 54,897 pages listed on this link. The issue arises when using Selenium; despite clicking on the next page button, it only superficially reloads the same page. Upon running the code, I noticed that ...

Python scripting for selecting elements using the selenium module

My website allows users to select from different price currencies using a <select> and <option> elements. Here is a snippet of the code: <div class="menu" style="display: none;"> <p class="current-country"> < ...

What is the best method to extract a specific value from a JSON object?

I have parsed a JSON file to extract data such as "Floor", "flat_no", and "Flat_id". Here is an example of the JSON structure: { "results": [ { "Flat_id": "1", "cat": "2", "Flat_no": "101", "Floor": "1", "Flat_t ...

Bidimensional Selenium matrix

Could someone please help me understand how to extract values from a bi-dimensional array using Selenium? I have a resources.js file with the array created, and need to access it in Selenium. Here is the structure of the array: The array consists of 4 col ...

Tips for validating a web element when the xpath locator varies in selenium webdriver

Every time an account is saved, the ID and Xpath for the "OK" button changes. Sample HTML Code: <div class="modal-footer" style="display: block;"> <div class="bootstrap-dialog-footer"> <div class="bootstrap-dialog-footer-buttons"> <b ...

Issue with the @JSONString annotation causing an Illegal Argument Exception in the code generated by Cloud Endpoints

Working on a Google Cloud Endpoint web service, the authentication finally worked, but facing issues with the generated code. The ProtoRPC message is constructed with Integer fields for object id, client_id, and high_water_mark. class NoteMessage(message ...

I am attempting to extract text from an element, but instead of the text, I received a value and am unable to click on it. This particular element is a dropdown button in a Selenium test, with

<div class="select-wrapper initialized"> <span class="caret">▼</span> <input type="text" class="select-dropdown" readonly="true" data-activates="select-options-56a6924e-42d9-1f78-1b82-fe2c1cbdfbdd" value="R3PORTS ...