0

I'm facing the issue that when I want to do sign in on apps using selenium WebDriver somehow when I clicked the button is not returning the status code which is causing the automation fail..

But when I tested in manually it's working fine and no problem occur, and when i paused the automation using debug mode I try to re-call the request it's working fine..

I saw few times this happened because of the NS_BINDING_ABORTED, but not sure if that's the cause of problem..

and yes I've tried and read all about this error but no luck https://github.com/SeleniumHQ/selenium/issues/10840

This is my code

package com.example.seleniumfirefox;

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

public class SeleniumFirefox {
    public static void main(String[] args) throws InterruptedException {
        System.setProperty("webdriver.gecko.driver", "C:\\Users\\yosafat.ksatria\\Downloads\\testing_selenium\\geckodriver.exe");

        FirefoxOptions options = new FirefoxOptions();
//      options.addArguments("start-maximized");
//      options.setLogLevel(FirefoxDriverLogLevel.TRACE);

        WebDriver webDriver = new FirefoxDriver(options);
        webDriver.manage().window().maximize();
        webDriver.manage().deleteAllCookies();

//      WebDriverWait wait = new WebDriverWait(webDriver, Duration.ofSeconds(15));
//      wait.until(driver -> "complete".equals(((JavascriptExecutor) driver)
//                      .executeScript("return document.readyState")));

        webDriver.get("https://seller-qa2-gcp.gdn-app.com/sign-in");
        Thread.sleep(5000);
        webDriver.findElement(By.id("email")).sendKeys("seller.usertwo@gdn-commerce.com"); //name locator for text box
        webDriver.findElement(By.id("password")).sendKeys("Password4321");
        Thread.sleep(6000);
//      WebElement btnLogin =
        webDriver.findElement(By.xpath("//*[@id=\"sign-in\"]")).click();
        Thread.sleep(60000);
//      btnLogin.click();
        webDriver.quit();
    }
}

Log Output:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
1679395089892   geckodriver INFO    Listening on 127.0.0.1:40007
1679395090325   mozrunner::runner   INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "16013" "--remote-allow-hosts" "localhost" "--remote-allow-origins" "http://127.0.0.1:16013/,http://localhost:16013/,http://[::1]:16013/" "-no-remote" "-profile" "C:\\Users\\YOSAFA~1.KSA\\AppData\\Local\\Temp\\rust_mozprofileloIXN2"
1679395090684   Marionette  INFO    Marionette enabled
WebDriver BiDi listening on ws://localhost:16013
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at C:\\Users\\YOSAFA~1.KSA\\AppData\\Local\\Temp\\rust_mozprofileloIXN2\\search.json.mozlz4", (void 0)))
1679395092367   Marionette  INFO    Listening on port 63916
Read port: 63916
1679395092447   RemoteAgent WARN    TLS certificate errors will be ignored for this session
DevTools listening on ws://localhost:16013/devtools/browser/6c3ed90b-0c38-4df2-b5e0-904ce455bbc4
console.error: "Exception when calling onAvailable handler" "Connection closed, pending request to server0.conn0.windowGlobal4294967297/cssPropertiesActor10, type getCSSDatabase failed\n\nRequest stack:\nrequest@resource://devtools/shared/protocol/Front.js:292:14\ngenerateRequestMethods/</frontProto[name]@resource://devtools/shared/protocol/Front/FrontClassWithSpec.js:46:19\ninitialize@resource://devtools/client/fronts/css-properties.js:58:28\nmanage@resource://devtools/shared/protocol/Front.js:146:19\ngetFront@resource://devtools/shared/protocol/types.js:559:18\ngetFront@resource://devtools/client/fronts/targets/target-mixin.js:332:15\n_getCssProperties@resource://devtools/client/inspector/inspector.js:571:45\n_onTargetAvailable@resource://devtools/client/inspector/inspector.js:275:12\n" (new Error("Connection closed, pending request to server0.conn0.windowGlobal4294967297/cssPropertiesActor10, type getCSSDatabase failed\n\nRequest stack:\nrequest@resource://devtools/shared/protocol/Front.js:292:14\ngenerateRequestMethods/</frontProto[name]@resource://devtools/shared/protocol/Front/FrontClassWithSpec.js:46:19\ninitialize@resource://devtools/client/fronts/css-properties.js:58:28\nmanage@resource://devtools/shared/protocol/Front.js:146:19\ngetFront@resource://devtools/shared/protocol/types.js:559:18\ngetFront@resource://devtools/client/fronts/targets/target-mixin.js:332:15\n_getCssProperties@resource://devtools/client/inspector/inspector.js:571:45\n_onTargetAvailable@resource://devtools/client/inspector/inspector.js:275:12\n", "resource://devtools/shared/protocol/Front.js", 106))
console.warn: "Error while destroying front:" "cssProperties" (new Error("Connection closed, pending request to server0.conn0.windowGlobal4294967297/cssPropertiesActor10, type getCSSDatabase failed\n\nRequest stack:\nrequest@resource://devtools/shared/protocol/Front.js:292:14\ngenerateRequestMethods/</frontProto[name]@resource://devtools/shared/protocol/Front/FrontClassWithSpec.js:46:19\ninitialize@resource://devtools/client/fronts/css-properties.js:58:28\nmanage@resource://devtools/shared/protocol/Front.js:146:19\ngetFront@resource://devtools/shared/protocol/types.js:559:18\ngetFront@resource://devtools/client/fronts/targets/target-mixin.js:332:15\n_getCssProperties@resource://devtools/client/inspector/inspector.js:571:45\n_onTargetAvailable@resource://devtools/client/inspector/inspector.js:275:12\n", "resource://devtools/shared/protocol/Front.js", 106))
console.warn: "Error while destroying front:" "accessibility" (new Error("Connection closed, pending request to server0.conn0.windowGlobal4294967297/accessibilityActor15, type getWalker failed\n\nRequest stack:\nrequest@resource://devtools/shared/protocol/Front.js:292:14\ngenerateRequestMethods/</frontProto[name]@resource://devtools/shared/protocol/Front/FrontClassWithSpec.js:46:19\ninitialize@resource://devtools/client/fronts/accessibility.js:536:46\nmanage@resource://devtools/shared/protocol/Front.js:146:19\ngetFront@resource://devtools/shared/protocol/types.js:559:18\ngetFront@resource://devtools/client/fronts/targets/target-mixin.js:332:15\n_getAccessibilityFront@resource://devtools/client/inspector/inspector.js:575:49\n_onTargetAvailable@resource://devtools/client/inspector/inspector.js:276:12\n", "resource://devtools/shared/protocol/Front.js", 106))
console.error: (new TypeError("this._cssProperties is undefined", "resource://devtools/client/inspector/inspector.js", 534))
JavaScript error: , line 0: uncaught exception: Object
console.error: "Unable to find target with innerWindowId:4294967303"
console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "https://seller-qa2-gcp.gdn-app.com"
console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "https://seller-qa2-gcp.gdn-app.com"
JavaScript error: resource://gre/modules/LoginManagerParent.jsm, line 136: TypeError: gRecipeManager is null
JavaScript error: , line 0: uncaught exception: Object
console.error: "Unable to find target with innerWindowId:4294967306"
console.error: "Unable to find target with innerWindowId:4294967306"
console.error: "Unable to find target with innerWindowId:4294967306"
console.error: "Unable to find target with innerWindowId:4294967306"
console.error: "Unable to find target with innerWindowId:4294967306"
Process finished with exit code 130

Operating System Windows 11

Selenium version Java 4.8.1

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

What are the browser driver(s) and version(s) where you see this issue? geckodriver-v0.31.0-win64

network output

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Yosafat Ksatria
  • 133
  • 1
  • 1
  • 14

1 Answers1

0

This error message...

Error: NS_BINDING_ABORTED (SessionNotCreated)

...implies that there was network error while initiating the GeckoDriver / session.


Deep Dive

As @whimboo explains in his comments:

Note that Firefox doesn't have a start-maximized command line argument but actually interprets it as the URL to open on startup (instead of about:blank). Internally start-maximized get completed to https://www.start-maximized.com/. This gets forward to some random page at least for me and then ends-up in a network error. Exactly this is what the NS_BINDING_ABORTED stands for.


Solution

While using GeckoDriver / you need to drop the argument:

options.addArguments("start-maximized");

or drop the line:

webDriver.manage().window().maximize();

tl; dr

"WebDriver:NewSession" can fail if Firefox gets started with some random URL that causes network errors

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352