Edge WebDriver in multiprocessing and multithreading mode not working with Python

External Issue #11011080

Details

Author
Jan M.
Created
Feb 20, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

When using Edge with webdriver, selenium and python 2.7 on Microsoft Windows, the code below crashes in multithreading and multiprocessing tests. However single process, single thread test case works perfectly ok.

import unittest
import traceback
from selenium import webdriver
from multiprocessing import Pool
from multiprocessing.pool import ThreadPool

browsers = {
    'Firefox': webdriver.Firefox,
    'Edge': webdriver.Edge,
    'Chrome': webdriver.Chrome,
}
test_page = 'http://example.com/'


def _worker(num):
    result = True
    try:
        driver = browsers['Edge']()
        driver.get(test_page)
    except Exception:
        print 'Exception {}'.format(traceback.format_exc())
        result = False
    finally:
        if 'driver' in locals():
            driver.quit()
    return result


class TestConcurrency(unittest.TestCase):

    def setUp(self):
        self.num_workers = 2

    def test_single_process(self):
        result = _worker(1)
        self.assertTrue(result)

    def test_multi_processing(self):
        worker_pool = Pool(self.num_workers)
        for result in worker_pool.imap(_worker, [x for x in range(self.num_workers)]):
            self.assertTrue(result)
        worker_pool.close()
        worker_pool.join()

    def test_multi_threading(self):
        worker_pool = ThreadPool(self.num_workers)
        for result in worker_pool.imap(_worker, [x for x in range(self.num_workers)]):
            self.assertTrue(result)
        worker_pool.close()
        worker_pool.join()


if __name__ == '__main__':
    unittest.main()

Exception thrown is:

Exception Traceback (most recent call last):
  File "test.py", line 21, in _worker
    driver = browsers['Edge']()
  File "C:\PROGRA~1\veritin\env\lib\site-    packages\selenium\webdriver\edge\webdriver.py", line 43, in __init__
desired_capabilities=capabilities)
  File "C:\PROGRA~1\veritin\env\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
  File "C:\PROGRA~1\veritin\env\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
  File "C:\PROGRA~1\veritin\env\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
  File "C:\PROGRA~1\veritin\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 163, in check_response
raise exception_class(value)
WebDriverException: Message: Unknown error

Testing Chrome and Firefox with the same code in Windows 10 works ok in all 3 cases.

To my best knowledge the Edge and MicrosoftWebDriver installation is correct, up to correct system compilation number. The same about chromedriver and geckodriver.

Selenium version==3.0.2
Python 2.7.13 64-bit
Windows 10 Home, version: 1607, compilation: 14393.693

It is important for me to have Edge working with Selenium in all three test cases. How can I achieve this?

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Brad E.”

      Changed Assigned To to “Sermet I.”

      Changed Assigned To to “Mara P.”

      Changed Assigned To from “Mara P.” to “Mustapha J.”

      Changed Title from “Edge WebDriver in multiprocessing and multithreading mode not working with Python” to “Edge WebDriver in multiprocessing and multithreading mode not working with Python”

      Changed Assigned To from “Mustapha J.” to “Clay M.”

      Changed Status to “External”

    • Edge doesn’t currently support running multiple sessions simultaneously. We have a work item to track this that I’ll dupe this bug to.

      Thanks,
      Clay

    • This issue has been resolved External. This means this issue may require a new feature to be implemented or other work that is more significant than a typical bug. You may be able to find more information on this issue by searching for related features on status.microsoftedge.com and uservoice.microsoftedge.com.

    You need to sign in to your Microsoft account to add a comment.

    Sign in