Skip to content

[πŸ› Bug]: Geckodriver.get(url) throws error : INFO: HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected)Β #14617

@Rima-tech-sql

Description

@Rima-tech-sql

What happened?

We are using Mozilla firefox browser on a VM and selenium script (on headless mode) on this server invokes the geckodriver GET(URL) command to open the target fusion URL.It throws an error (attached)
Server team has confirmed that there are no security restrictions and we have verified the connectivity with telnet commands and its connecting to the URLs from this VM

Versions are -

  1. Firefox 128.2.0esr
  2. Geckodriver 0.35 (Tried 0.30 as well)
  3. Selenium 3.14

This is the part of the code, right after the driver.get(targetURL), we get the error. Have Attached the complete error.
FirefoxOptions options = new FirefoxOptions();
options.setHeadless(true);
options.addPreference("webdriver_firefox_port", 44321); // Use any available port
options.addPreference("app.update.enabled", false); // Disable automatic updates

                System.setProperty("java.net.preferIPv4Stack", "true");

                options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.IGNORE);
                //Uncomment this when you performing testing from local
                System.setProperty("webdriver.gecko.driver", "geckodriver");
                //Uncomment this when you deploying app in server
                printException("Before Driver COnnection" , 1, con, null);
                
            //    System.setProperty("webdriver.gecko.driver", "/u01/app/oracle/deployment/selenium/geckodriver");
                
                driver = new FirefoxDriver(options);
                driver.manage().window().maximize();
                System.out.println("After Firefox driver connection");
                printException("After Driver COnnection" , 1, con, null);
                
                
                driver.get(targetUrl);    

Any help around this is much appreciated.
console.error.txt

How can we reproduce the issue?

package selenium;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.net.HttpURLConnection;
import java.net.URL;

import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;

import javax.sql.rowset.serial.SerialBlob;

import org.apache.commons.lang3.exception.ExceptionUtils;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.UnexpectedAlertBehaviour;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;

public class SeleniumTesting implements Constants {
    static boolean isNotInserted=false;
    public static void main(String args[]){
        try {
            System.out.println("Start of SeleniumTesting");
            try (Connection con = ConnectionManager.getConnection()) {
                Payload p=new Payload();
                p.setRunId("33623");
                p.setTaskName("Manage Currencies");
                p.setFileId("29830910460206342");
              //  p.setTaskName(taskName);
                p.setTargetUrl("https://xxxxxxxxxxxxx.fa.us2.oraclecloud.com");
                seleniumTest(p);
            }   
        } catch (Exception e) {

              e.printStackTrace();
        }
        
    }
  /**
   * @method printException
   * @param err_message
   * @param err_level
   * @param con
   * @desc Insert Exceptions into Database
   */
  
    public static void printException(String err_message, int err_level, Connection con, StringBuilder sb) {
        try {
            Runtime rt = Runtime.getRuntime();
            System.out.println("In Print Exception : "+ err_message);
            if (err_level >= 0) {
                try (CallableStatement cs = con.prepareCall("begin XXFSM_LOG(?,?,?); end;")) {
       
                    
                    
                    cs.setString(1, err_message);
                    cs.setString(2, SELENIUM_TASK);
                    cs.setInt(3, err_level);
                    cs.execute();
                }
            }
        }catch (Exception e) {
        
           // printException(EXCEPTION+ExceptionUtils.getStackTrace(e) , 1, con, null);
           System.out.println("In Print Exception : "+ EXCEPTION+ExceptionUtils.getStackTrace(e));
        }
    }

  public static String seleniumTest(Payload data) throws SQLException {
        WebDriver driver = null;
        Map<String,String> userCredMap=new HashMap<>();
        StringBuilder stringBuilder = new StringBuilder("Result=");
        try (Connection con = ConnectionManager.getConnection()) {
            
            try {
                String runId = data.getRunId();
                userCredMap=getUserCredentials(con, runId);
               
                if(!userCredMap.isEmpty()){
                    
                    String fileId = data.getFileId();
                    String projectName = data.getProjectName();
                    String taskName = data.getTaskName();
                    String targetUrl = data.getTargetUrl();
                
                    String username =userCredMap.get(USERNAME);
                    String password = userCredMap.get(PASSWORD);
                    System.out.println("Before Firefox driver connection");
                    
                    FirefoxOptions options = new FirefoxOptions();
                    options.setHeadless(true);
                    options.addPreference("webdriver_firefox_port", 44321); // Use any available port
                    options.addPreference("app.update.enabled", false);  // Disable automatic updates

                    System.setProperty("java.net.preferIPv4Stack", "true");

                    options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.IGNORE);
                    //Uncomment this when you performing testing from local
                    System.setProperty("webdriver.gecko.driver", "geckodriver");
                    //Uncomment this when you deploying app in server
                    printException("Before Driver COnnection" , 1, con, null);
                    
                   // System.setProperty("webdriver.gecko.driver", "/u01/app/oracle/deployment/selenium/geckodriver");
                    
                    driver = new FirefoxDriver(options);
                    driver.manage().window().maximize();
                    System.out.println("After Firefox driver connection");
                    printException("After Driver COnnection" , 1, con, null);
                    
                    
                    driver.get(targetUrl);    
                    printException("After URL Connectivity" , 1, con, null);
                    printException("HTML="+driver.getPageSource() , 1, con, null);
                    
                    try(PreparedStatement ps=con.prepareStatement("SELECT TASK_NAME FROM TASK_LIST_TBL XTLT,PRJ_TASK_LIST XPTL WHERE XTLT.TASK_CODE=XPTL.TASK_CODE AND XPTL.PRJ_RUN_ID=?")){
                    
                        ps.setString(1, runId);
                        try(ResultSet rs=ps.executeQuery()){
                            while(rs.next()){
                                
                                                            taskName=rs.getString(1);
                            }
                        }
                    }
                                    if (taskName.contains("Attributes")) {
                        try{
                            executeProcess1(driver, con, stringBuilder, fileId, runId, projectName,taskName ,username, password);
                        }catch(Exception e){
                        
                            printException(EXCEPTION+ExceptionUtils.getStackTrace(e) , 1, con, null);
                        }
                    }
                    else{
                            try{
                    
                                executeProcess(driver, con, stringBuilder, fileId, runId, projectName, taskName, username, password);
                            }catch(Exception e){
                            
                                printException(EXCEPTION+ExceptionUtils.getStackTrace(e) , 1, con, null);
                            }
                        }   
                }else{
                    
                }
            } catch (Exception e) {
                e.printStackTrace();
                printException(EXCEPTION+ExceptionUtils.getStackTrace(e) , 1, con, null);
            }finally{
                if(driver!=null){
                    driver.close();
                }
            }
        }
        return stringBuilder.toString();
    }

Relevant log output

console.error: (new TypeError("NetworkError: Network request failed", "resource://services-settings/Utils.sys.mjs", 236))
console.error: (new TypeError("NetworkError: Network request failed", "resource://services-settings/Utils.sys.mjs", 236))
console.error: (new Error("Polling for changes failed: NetworkError: Network request failed.", "resource://services-settings/remote-settings.sys.mjs", 324))
Sep 29, 2024 7:42:35 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected)
org.openqa.selenium.TimeoutException: Navigation timed out after 300000 ms
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'gc3soarconfl405', ip: '172.16.148.22', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-210.163.7.el8uek.x86_64', java.version: '11.0.24'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 128.2.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20240918160929, moz:geckodriverVersion: 0.35.0, moz:headless: true, moz:platformVersion: 5.15.0-210.163.7.el8uek.x86_64, moz:processID: 722602, moz:profile: /tmp/rust_mozprofilelDfw58, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, userAgent: Mozilla/5.0 (X11; Linux x86...}
Session ID: 01fb1879-776c-414c-8c68-9e6b45b900a8
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
      at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
      at selenium.SeleniumTesting.seleniumTest(SeleniumTesting.java:127)
      at selenium.SeleniumAPIBackgroundProcess$ExampleHandler.handle(SeleniumAPIBackgroundProcess.java:89)
      at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
      at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
      at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
      at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:849)
      at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
      at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:818)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
1727638955424     Marionette  INFO  Stopped listening on port 36677

Operating System

x86_64 GNU/Linux

Selenium version

Selenium 3.14.0

What are the browser(s) and version(s) where you see this issue?

Firefox 128.2.0esr

What are the browser driver(s) and version(s) where you see this issue?

Geckodriver 0.35 (Tried 0.30 as well)

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions