Why isn't selenium able to fetch the URL?

This is a code snippet that opens Firefox and navigates to Google using Selenium WebDriver:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class AutomateBrowser {


    public static void main(String[] args) {
        System.setProperty("webdriver.gecko.driver", "//root//Desktop//jarselenium//geckodriver-v0.20.1-linux64/geckodriver");
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();
        //driver.get("https://www.easybooking.lk/login");
        //driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); 
        driver.get("https://www.google.com");

    }

}

However, the issue reported is that when running this code on Linux, Firefox opens but doesn't navigate to the specified URL.

Answer №1

Based on the current setup with Selenium version 3.11.0 and GeckoDriver 0.20.1, there don't appear to be any significant issues in your code snippet. Including trace logs could have provided more insight into the problem at hand. However, make sure to follow these steps:

  • If you are working on a Linux-based system, ensure to use the absolute path of the GeckoDriver with single forward slashes (i.e., /) like this:

    System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver-v0.20.1-linux64/geckodriver");
    
  • Since GeckoDriver automatically opens the Firefox Browser in maximized mode, remove the line of code:

    driver.manage().window().maximize();
    

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

The command driver.quit() triggers an error in Firefox, causing the browser to crash

When the driver.quit() method is called, it causes Firefox to stop working. Although the tests do not fail, every time driver.quit is executed, the browser crashes as seen in the image below. This is my code snippet: public void quitDriver() throws E ...

Challenges arise when using Selenium IDE with a fresh XPath implementation

I am facing an issue with using Xpath in Selenium IDE. It's strange that when I right-click on the element, the Selenium Options do not appear. Furthermore, upon inspecting the element with Firebug and copying the XPath, the result is: //html/body/d ...

Error message org.openqa.selenium.NoSuchElementException is showing up only in Internet Explorer, while the code is running smoothly in Chrome and Firefox

I have created a login script that successfully runs on ChromeDriver and FFDriver, but encounters an error when executed using IE Driver. The error message is as follows: Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to fin ...

Steps for converting an Mqtt5 payload back into JSON

Is there a way to convert the result from Mqtt5Publish.getPayloadAsBytes() into a JSON string that is properly formatted? For example, how can I take a message published in this format: '{"SampleData0": "1.2.3", "SampleData1& ...

The error message java.lang.NumberFormatException: Unable to parse the input string: "2017-01-28 13:28:20" occurred

During the execution of my java project, I encountered an error with a Gson deserializer function. The error message states: java.lang.NumberFormatException: For input string: "2017-01-28 13:28:20" at java.lang.NumberFormatException.forInputString(NumberF ...

Having trouble clicking on a class and image with Selenium

I'm running into an issue with Selenium web driver where I cannot click on the search image. I've tried using XPath as well as Selenium IDE, but nothing seems to work. Here's the code snippet using XPath: driver.findElement(By.xpath("//for ...

Exploring Firefox extension elements with Selenium: A step-by-step guide

I am looking to extract a link from a notification generated by an extension using Selenium for testing purposes across various websites. The specific extension I am working with is demonstrated in this GitHub example full code available here. It showcase ...

Encountering an unidentified issuer error code (SEC_ERROR_UNKNOWN_ISSUER) while using Python Webdriver with Firefox profiles

I've searched all over the internet but am still struggling to fix the error I encountered while attempting to run a test script on my testing environment. "The certificate is not trusted because the issuer certificate is unknown. The server migh ...

Exploring the Features and Functions of Google Chrome Through Selenium

Is it feasible to establish the Chrome homepage using capabilities and Chrome options within Selenium? ...

The application concludes when the user inputs the password into the textbox using the web runner extension

private static void openGoogleSignInPage() { System.setProperty("webdriver.chrome.driver", "C://chromedriver//chromedriver.exe"); WebDriver driver = new ChromeDriver(); //Maximize the Browser window driver.manage().window().maximize(); ...

Selenium - Issue arises with script malfunction following Firefox's recent update

After updating Firefox to version 43.0.1, a script that previously worked fine has started failing. Interestingly, the same script works flawlessly in Google Chrome. The error message being displayed is: org.openqa.selenium.firefox.NotConnectedExcepti ...

Is Selenium IEDriverServer causing sluggish text input?

While using Selenium IEDriverServer 3.5.1 32bit, I have encountered extremely slow text entry in Internet Explorer v11. Interestingly, switching to IEDriverServer 3.4.0 (also 32bit) eliminates the slowness issue, but overall test execution is slightly slow ...

the function presence_of_all_elements_located does not provide the entire list when used for web scraping using Selenium

Trying to retrieve a complete list of food names from this menu seems to be presenting a challenge. Despite the fact that there are more elements with the specified class name, only 9 items are being retrieved. Utilizing Google Developer tools, it is evi ...

Using Python, Selenium can engage with search input fields

This is a webpage for conducting searches, with the following layout: <input type="search" title="Search Site" aria-label="Keywords" placeholder="Keywords" autocomplete="off" value=""> < ...

Tips for serializing enum lists from a restful API

My goal is to enhance the JSON format returned by a REST API call, displaying both the enum names and their corresponding values. Currently, the JSON response looks like this: { "responses": [ "ACTION_TAKEN", "IGNORED", "UNDETECTED" ] } I ...

Python web scraping with Beautiful Soup and Selenium: a powerful combination suite for extracting data

set up chromium, its driver, and selenium !apt update !apt install chromium-chromedriver !pip install selenium # configure options for headless browsing from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument('-- ...

IDE1007: The variable 'settings' is not recognized in the current context (Java), even though it should be within the same scope based on my understanding

Issue The error in my program is related to the following code snippet: The name 'options' does not exist in the current context public class CCL { public IWebDriver myDriver; public ChromeOptions options = new ChromeOptions( ...

A guide on repositioning draggable child elements within the same parent using Selenium with Python

Consider the following HTML structure: <div name="parent"> <div name="child one"> </div> <div name="child two"> </div> <div name="child three"> </div> <div name="child four"> </div> < ...

Is it possible to use Selenium without the browser showing up on the screen?

I am looking to extract web data generated by JavaScript functions using selenium without displaying the automated actions on my browser screen. What is the best way to accomplish this? ...

Submenu Positioning Problem Identified in Firefox Display

I am currently working on a menu design for a website and encountered an unusual issue while testing it in Firefox. In the provided fiddle link, you can view the menu layout where hovering over the information button should display a submenu directly below ...