0

I need to run some tests on remote Windows in IE and Chrome browsers. But I get the Timeout error on the main computer and Exit value: -1073741819 on remote. I have the latest version of drivers and server. I use 32bit Selenium Server on 64 Windows (it is recommended)

I've added all to PATH, but if I run chromedriver via cmd I get nothing. I have no idea why (the same in admin mode)

If I run the tests locally on Windows via Pycharm I don't have any issues even I run it via Server using localhost:4444 as a remote URL The problem only with running remotely.

Is there any solution how to fix that problem?

I have in my Python code:

desired_capabilities: DesiredCapabilities = {
            'chrome': DesiredCapabilities.CHROME,
            'firefox': DesiredCapabilities.FIREFOX,
            'IE': DesiredCapabilities.INTERNETEXPLORER,}.get(browser, DesiredCapabilities.CHROME)

driver = webdriver.Remote(command_executor=remote_url, desired_capabilities=desired_capabilities)

I use command for run:

pytest tests/test.py --remote_url Remote_IP:4444/wd/hub --browser IE

The Selenium server can see my request and shows in the Windows terminal:

12:53:00.975 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "internet explorer",
  "platform": "WINDOWS",
  "version": ""
}
12:53:00.975 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.ie.InternetExplorerDriverService)
12:53:21.022 ERROR [OsProcess.checkForError] - org.apache.commons.exec.ExecuteException: Process exited with an error: -1073741819 (Exit value: -1073741819)

Also in my local terminal, I see the error:

E selenium.common.exceptions.WebDriverException: Message: Timed out waiting for driver server to start.
E Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
E System info: host: 'HOST NAME', ip: 'REMOTE IP', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
E Driver info: driver.version: unknown
E Stacktrace:
E at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable (DriverService.java:202)
E at org.openqa.selenium.remote.service.DriverService.start (DriverService.java:188)
E at org.openqa.selenium.grid.session.remote.ServicedSession$Factory.apply (ServicedSession.java:155)
E at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12 (ActiveSessionFactory.java:180)
E at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$11$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
E at java.util.Spliterators$ArraySpliterator.tryAdvance (None:-1)
E at java.util.stream.ReferencePipeline.forEachWithCancel (None:-1)
E at java.util.stream.AbstractPipeline.copyIntoWithCancel (None:-1)
E at java.util.stream.AbstractPipeline.copyInto (None:-1)
E at java.util.stream.AbstractPipeline.wrapAndCopyInto (None:-1)
E at java.util.stream.FindOps$FindOp.evaluateSequential (None:-1)
E at java.util.stream.AbstractPipeline.evaluate (None:-1)
E at java.util.stream.ReferencePipeline.findFirst (None:-1)
E at org.openqa.selenium.remote.server.ActiveSessionFactory.apply (ActiveSessionFactory.java:183)
E at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2 (NewSessionPipeline.java:66)
E at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
E at java.util.Collections$2.tryAdvance (None:-1)
E at java.util.stream.ReferencePipeline.forEachWithCancel (None:-1)
E at java.util.stream.AbstractPipeline.copyIntoWithCancel (None:-1)
E at java.util.stream.AbstractPipeline.copyInto (None:-1)
E at java.util.stream.AbstractPipeline.wrapAndCopyInto (None:-1)
E at java.util.stream.FindOps$FindOp.evaluateSequential (None:-1)
E at java.util.stream.AbstractPipeline.evaluate (None:-1)
E at java.util.stream.ReferencePipeline.findFirst (None:-1)
E at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3 (NewSessionPipeline.java:69)
E at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
E at java.util.stream.DistinctOps$1$2.accept (None:-1)
E at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
E at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
E at java.util.stream.Streams$StreamBuilderImpl.tryAdvance (None:-1)
E at java.util.stream.Streams$ConcatSpliterator.tryAdvance (None:-1)
E at java.util.stream.ReferencePipeline.forEachWithCancel (None:-1)
E at java.util.stream.AbstractPipeline.copyIntoWithCancel (None:-1)
E at java.util.stream.AbstractPipeline.copyInto (None:-1)
E at java.util.stream.AbstractPipeline.wrapAndCopyInto (None:-1)
E at java.util.stream.FindOps$FindOp.evaluateSequential (None:-1)
E at java.util.stream.AbstractPipeline.evaluate (None:-1)
E at java.util.stream.ReferencePipeline.findFirst (None:-1)
E at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:72)
E at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:65)
E at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:235)
E at java.util.concurrent.Executors$RunnableAdapter.call (None:-1)
E at java.util.concurrent.FutureTask.run (None:-1)
E at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
E at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
E at java.lang.Thread.run (None:-1) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException

Also I get logs (REMOTE_IP is the remote Windows address):

remote_connection.py 390 DEBUG POST REMOTE_IP:4444/wd/hub/session {"capabilities": {
"firstMatch": [{}], "alwaysMatch": {"browserName": "internet explorer", "platformName": "windows"}}, 
"desiredCapabilities": 
    {"browserName": "internet explorer", 
     "version": "", 
     "platform": "WINDOWS"}}

connectionpool.py 208 DEBUG Starting new HTTP connection (1): REMOTE_IP
connectionpool.py 396 DEBUG http://REMOTE_IP:4444 "POST /wd/hub/session HTTP/1.1" 500 14404
remote_connection.py 442 DEBUG Finished Request
MaxT
  • 1
  • 3
  • DebanjanB - could you please give a link on another question and answers about that issue, if it was marked as duplicate? I would like to repeat my comment I posted in Answer section - my question is not about waiting for elements, it is about issues between Selenium Server and browser's drivers. I tried to find similar questions here but I didn't find (I found only how to add drivers to PATH). So if you have something - it would be great – MaxT Jan 15 '19 at 20:06

2 Answers2

0

You can use explicit wait to avoid timeout what it will do is wait 10 seconds until to found if not it will throw timeout error and you can increase time to 30 seconds as much you want

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Firefox()
driver.get("http://somedomain/url_that_delays_loading")
try:
    element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, "myDynamicElement"))
    )
finally:
    driver.quit()

if this doesn't work then you can use sleep method from Thread using time

time.sleep(5)
akshay patil
  • 670
  • 7
  • 20
  • No, it does not work because there is an issue not in finding some element via driver. There is an issue in waiting for a response from the driver in general, using Selenium Server on the remote computer. – MaxT Jan 15 '19 at 20:03
  • you can use sleep method for that if possible then show the console error or information for proper understanding of the problem – akshay patil Jan 16 '19 at 04:31
0

you can add implicit wait to let driver wait for element at every step. Default time for implicit wait is 0

driver.implicitly_wait(10) #timeout in seconds
Ankit Agrawal
  • 257
  • 1
  • 12