Search code examples
powershellseleniumselenium-webdriverselenium-chromedriverstart-job

Selenium in Powershell does not work correctly in Start-Job


I am trying to execute PowerShell script with Selemiun using Start-Job

Start-Job {
    $Url = 'https://stackoverflow.com/'
    $Driver = Start-SeChrome
    Enter-SeUrl -Url $Url  -Driver $Driver
    }

The script should open Chrome and follow the link. Instead, it just opens Chrome.

Everything works correctly without Start-Job. The only thing I noticed is the lack of a command prompt window with chromedriver.exe running. But judging by the Task Manager, chromedriver.exe starts up

Finding a solution is complicated by the fact that I do not know how to read the errors that occur when starting Start-job.


Solution

  • Thanks a lot Avshalom for the tip. Validly using PoshRSJob module solved my problem. Selenium is finally working correctly.