maven 如何修复此错误?无法解析URL:http://localhost:登录注册/session

kcwpcxri  于 8个月前  发布在  Maven
关注(0)|答案(1)|浏览(72)

我是一个初学者在selenuim网络驱动程序,我尝试了很多东西来解决这个错误,但我不能解决它

package Com.google.SeleniumNew;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class ChromeDriverDemo {

    public static void main(String[] args) {
        WebDriverManager.firefoxdriver().setup();

        
        WebDriver driver= new FirefoxDriver();

        
        driver.get("http://www.google.com");

    }

}

然后给予我这些错误

--marionette-host <HOST>
        Host to use to connect to Gecko [default: 127.0.0.1]

    --marionette-port <PORT>
        Port to use to connect to Gecko [default: system-allocated port]

-p, --port <PORT>
        Port to use for WebDriver server [default: 4444]

    --profile-root <PROFILE_ROOT>
        Directory in which to create profiles. Defaults to the system temporary directory.

-v
        Log level verbosity (-v for debug and -vv for trace level)

-V, --version
        Prints version and copying information

    --websocket-port <PORT>
        Port to use to connect to WebDriver BiDi [default: 9222]

Exception in thread "main" org.openqa.selenium.WebDriverException: java.io.IOException: Unable to parse URL: http://localhost:٤٠١٩٦/session
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'HUSSIEN', ip: '192.168.2.7', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '17.0.7'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at Com.google.SeleniumNew.ChromeDriverDemo.main(ChromeDriverDemo.java:18)
Caused by: java.io.IOException: Unable to parse URL: http://localhost:٤٠١٩٦/session
    at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:64)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    ... 6 more

我把selenium改为4.7.1,

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/C:/Users/Hussien%20saeid/.m2/repository/org/slf4j/slf4j-nop/1.7.28/slf4j-nop-1.7.28.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
C:\Users\Hussien saeid\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe: error: invalid --port: invalid digit found in string: ٣٥٦٩٤
geckodriver 0.33.0 (a80e5fd61076 2023-04-02 18:31 +0000) 
WebDriver implementation for Firefox

USAGE:
    geckodriver.exe [OPTIONS]

OPTIONS:
        --allow-hosts <ALLOW_HOSTS>...
            List of hostnames to allow. By default the value of --host is allowed, and in addition
            if that's a well known local address, other variations on well known local addresses are
            allowed. If --allow-hosts is provided only exactly those hosts are allowed.

        --allow-origins <ALLOW_ORIGINS>...
            List of request origins to allow. These must be formatted as scheme://host:port. By
            default any request with an origin header is rejected. If --allow-origins is provided
            then only exactly those origins are allowed.

        --android-storage <ANDROID_STORAGE>
            Selects storage location to be used for test data (deprecated). [possible values: auto,
            app, internal, sdcard]

    -b, --binary <BINARY>
            Path to the Firefox binary

        --connect-existing
            Connect to an existing Firefox instance

    -h, --help
            Prints this message

        --host <HOST>
            Host IP to use for WebDriver server [default: 127.0.0.1]

        --jsdebugger
            Attach browser toolbox debugger for Firefox

        --log <LEVEL>
            Set Gecko log level [possible values: fatal, error, warn, info, config, debug, trace]

        --log-no-truncate
            Disable truncation of long log lines

        --marionette-host <HOST>
            Host to use to connect to Gecko [default: 127.0.0.1]

        --marionette-port <PORT>
            Port to use to connect to Gecko [default: system-allocated port]

    -p, --port <PORT>
            Port to use for WebDriver server [default: 4444]

        --profile-root <PROFILE_ROOT>
            Directory in which to create profiles. Defaults to the system temporary directory.

    -v
            Log level verbosity (-v for debug and -vv for trace level)

    -V, --version
            Prints version and copying information

        --websocket-port <PORT>
            Port to use to connect to WebDriver BiDi [default: 9222]

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'HUSSIEN', ip: '192.168.2.7'
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:159)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:111)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
    at Com.google.SeleniumNew.ChromeDriverDemo.main(ChromeDriverDemo.java:18)
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.7.1', revision: 'c6795baf1a3'
System info: os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '17.0.7'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:243)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:98)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:551)
    ... 6 more
sqougxex

sqougxex1#

这个问题是通过升级我的窗口从8到10解决谢谢大家

相关问题