проблема с запуском RemoteWebDriver с прокси

remote
execution
java
webdriver
Теги: #<Tag:0x00007fedb8f2d160> #<Tag:0x00007fedb8f2cfd0> #<Tag:0x00007fedb8f2cdf0> #<Tag:0x00007fedb8f2cc88>

#1

Помогите, пожалуйста, разобраться с ошибкой. При запуске, все прокси инициализируются, а браузер так и не запускается. код:

public static WebDriver initFireFoxWithProxyDocker() throws MalformedURLException {
        DesiredCapabilities capability = DesiredCapabilities.firefox();

        Proxy proxy = new Proxy();
        String comProxy = "us.proxy.*******.com:3128";

        proxy.setProxyType(Proxy.ProxyType.MANUAL);
        proxy.setHttpProxy(comProxy);
        proxy.setFtpProxy(comProxy);
        proxy.setSocksProxy(comProxy);
        proxy.setSslProxy(comProxy);

        capability.setCapability(CapabilityType.PROXY, proxy);

        WebDriver driver = new RemoteWebDriver(new URL(getProps().getRemoteWebDriverUrlWithDocker()), capability);

        return driver;

ошибка:

Connected to the target VM, address: '127.0.0.1:57162', transport: 'socket'

org.openqa.selenium.SessionNotCreatedException: InvalidArgumentError: Expected [object Undefined] undefined to be an integer
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: '30da53f3fd88', ip: '172.18.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-83-generic', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:           0x4fa94d - backtrace::backtrace::trace::h45ace4059cd74233
   1:           0x4fae32 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc
   2:           0x4349d9 - webdriver::error::WebDriverError::new::h449345a591a119fd
   3:           0x445e2b - geckodriver::marionette::MarionetteSession::response::hac27afe85c07f033
   4:           0x443b14 - <geckodriver::marionette::MarionetteHandler as webdriver::server::WebDriverHandler<geckodriver::marionette::GeckoExtensionRoute>>::handle_command::hd89c5efbeb4c7cd5
   5:           0x434e94 - webdriver::server::start::{{closure}}::h5e71183f67357de6
   6:           0x408627 - std::panicking::try::do_call::h8c30e6af4c7f85af
   7:           0x5b77fa - panic_unwind::__rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libpanic_unwind/lib.rs:98
   8:           0x416e57 - <F as alloc::boxed::FnBox<A>>::call_box::h3f273b2445d78deb
   9:           0x5b0014 - alloc::boxed::{{impl}}::call_once<(),()>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/liballoc/boxed.rs:624
                         - std::sys_common::thread::start_thread
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys_common/thread.rs:21
                         - std::sys::imp::thread::{{impl}}::new::thread_start
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys/unix/thread.rs:84
Command duration or timeout: 4.27 seconds

	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
	at utils.Utils.initFireFoxWithProxyDocker(Utils.java:1164)
	at top200reports.Testclass.rowsNotFound(Testclass.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.openqa.selenium.SessionNotCreatedException: InvalidArgumentError: Expected [object Undefined] undefined to be an integer
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: '30da53f3fd88', ip: '172.18.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-83-generic', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:           0x4fa94d - backtrace::backtrace::trace::h45ace4059cd74233
   1:           0x4fae32 - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc
   2:           0x4349d9 - webdriver::error::WebDriverError::new::h449345a591a119fd
   3:           0x445e2b - geckodriver::marionette::MarionetteSession::response::hac27afe85c07f033
   4:           0x443b14 - <geckodriver::marionette::MarionetteHandler as webdriver::server::WebDriverHandler<geckodriver::marionette::GeckoExtensionRoute>>::handle_command::hd89c5efbeb4c7cd5
   5:           0x434e94 - webdriver::server::start::{{closure}}::h5e71183f67357de6
   6:           0x408627 - std::panicking::try::do_call::h8c30e6af4c7f85af
   7:           0x5b77fa - panic_unwind::__rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libpanic_unwind/lib.rs:98
   8:           0x416e57 - <F as alloc::boxed::FnBox<A>>::call_box::h3f273b2445d78deb
   9:           0x5b0014 - alloc::boxed::{{impl}}::call_once<(),()>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/liballoc/boxed.rs:624
                         - std::sys_common::thread::start_thread
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys_common/thread.rs:21
                         - std::sys::imp::thread::{{impl}}::new::thread_start
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys/unix/thread.rs:84
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'LAZURKO', ip: '10.10.82.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
	at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:108)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:137)
	at sun.reflect.GeneratedConstructorAccessor21.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:81)
	at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:63)
	at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
	at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
	at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

(Vasiliy Rakshin) #2

Скорее всего, надо порт отдельно указывать. У вас сама шибка и выдаёт - ожидается интеджер.
https://github.com/mozilla/geckodriver - раздел WebDriver capabilities - proxy object для каждого Proxy надо указывать порт.


#3

не нашла функцию для задания порта отдельно и в классе Proxy есть только такие параметры
public class Proxy {
private Proxy.ProxyType proxyType;
private boolean autodetect;
private String ftpProxy;
private String httpProxy;
private String noProxy;
private String sslProxy;
private String socksProxy;
private String socksUsername;
private String socksPassword;
private String proxyAutoconfigUrl;


(Vasiliy Rakshin) #4

Да, поспешил я, посмотрел - да, вы правильно задаёте прокси, моя подсказка неверна.
А версия геккодрайвера свежая?


#5

Это удаленный вебдрайвер, там последняя версия.