Skip to content

[🐛 Bug]: When the hub adds user authentication, the Webelement.getAttribute() method will get stuck #1449

@lsc196

Description

@lsc196

What happened?

public class Test {
    public static void main(String[] args) throws Exception {
        WebDriver driver = driver = new RemoteWebDriver(
                new URL("http://admin:myStrongPassword@localhost:4444"),
                new ChromeOptions());
        driver.get("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&wd=java");
        List<WebElement> elements = driver.findElements(By.cssSelector("h3 >a"));
        for (WebElement item: elements) {
            System.out.println(item.getText());
            String aClass = item.getAttribute("class");
            System.out.println(aClass);
        }
        driver.quit();
    }
}

Everything is normal ahead . System.out.println(item.getText()); will normal. It will get stuck when String aClass = item.getAttribute("class"); is executed

Command used to start Selenium Grid with Docker

version: "3"
services:
  chrome1:
    image: selenium/node-chrome:4.0.0-20211025
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=duoyi-selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_GRID_URL=http://localhost:4444
        #配置屏幕分辨率  
      - SCREEN_WIDTH=1920
      - SCREEN_HEIGHT=1080
      - SCREEN_DEPTH=24
      - VNC_VIEW_ONLY=1 
    ports:
      - "6901:5900"
      - "7900:7900"
    volumes:
      - "./config:/home/seluser/.config"

  duoyi-selenium-hub:
    image: selenium/hub:4.0.0-20211025
    container_name: selenium-hub
    environment:
      - SE_OPTS=--username admin --password myStrongPassword
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"

Relevant log output

duoyi-selenium-hub    | 12:28:15.961 INFO [BasicAuthenticationFilter.lambda$apply$0] - Unauthorized request to (POST) /session
duoyi-selenium-hub    | 12:28:16.873 INFO [LocalDistributor.newSession] - Session request received by the distributor: 
duoyi-selenium-hub    |  [Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}]
chrome1_1             | Starting ChromeDriver 95.0.4638.69 (6a1600ed572fedecd573b6c2b90a22fe6392a410-refs/branch-heads/4638@{#984}) on port 57035
chrome1_1             | Only local connections are allowed.
chrome1_1             | Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
chrome1_1             | [1636547296.973][SEVERE]: bind() failed: Cannot assign requested address (99)
chrome1_1             | ChromeDriver was started successfully.
chrome1_1             | 12:28:17.797 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
duoyi-selenium-hub    | 12:28:17.830 INFO [LocalDistributor.newSession] - Session created by the distributor. Id: 601982ea95d43c772084c95f7685a4cd, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 95.0.4638.69, chrome: {chromedriverVersion: 95.0.4638.69 (6a1600ed572fe..., userDataDir: /tmp/.com.google.Chrome.E69n0u}, goog:chromeOptions: {debuggerAddress: localhost:37223}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: {}, se:cdp: ws://localhost:4444/session..., se:cdpVersion: 95.0.4638.69, se:vnc: ws://localhost:4444/session..., se:vncEnabled: true, se:vncLocalAddress: ws://192.168.240.5:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
duoyi-selenium-hub    | 12:28:17.905 INFO [BasicAuthenticationFilter.lambda$apply$0] - Unauthorized request to (POST) /session/601982ea95d43c772084c95f7685a4cd/window/maximize
duoyi-selenium-hub    | 12:28:18.094 INFO [BasicAuthenticationFilter.lambda$apply$0] - Unauthorized request to (POST) /session/601982ea95d43c772084c95f7685a4cd/url
duoyi-selenium-hub    | 12:28:42.570 INFO [BasicAuthenticationFilter.lambda$apply$0] - Unauthorized request to (POST) /session/601982ea95d43c772084c95f7685a4cd/elements
duoyi-selenium-hub    | 12:28:42.635 INFO [BasicAuthenticationFilter.lambda$apply$0] - Unauthorized request to (GET) /session/601982ea95d43c772084c95f7685a4cd/element/40bfb33a-a1ee-479a-8f98-db762132d74d/text
duoyi-selenium-hub    | 12:28:42.700 INFO [BasicAuthenticationFilter.lambda$apply$0] - Unauthorized request to (POST) /session/601982ea95d43c772084c95f7685a4cd/execute/sync

Operating System

docker in Debain9,client in win10

Docker Selenium version (tag)

4.0.0-20211025

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions