Running Selenium Tests

I’ve seen a few posts in the forum related to Selenium testing but haven’t seen anything that might explain the behavior I’m seeing. I’ve also seen several posts online and youtube videos about folks running .NET based Selenium tests via Octopus, so I know it if possible.

In my environment, I’m using NUnit as the test executor and running the tests via a powershell script during the deploy process (nunit3-console.exe mytest.dll --test Test_I_Want_To_Run). I’m using the Chrome WebDriver and passing in arguments at startup to run in headless mode, and setting the browser size to 1920x1080. I’m also setting the browser size using the Selenium API. The test runs successfully on the Windows 10 box when I run it as a logged in user. When Octopus runs it, the test starts and is unable to locate elements on the page, which I believe to be caused by the fact that the browser window is not sized correctly or visible at all (my test takes a screenshot on failure, and the screenshot is blank).

I’ve also tried setting the Octopus Tentacle Service user to run as local system with “Allow service to interact with desktop” checked. That did not help.

Does anyone have any thoughts about what might be incorrect in the Octopus execution environment that is causing the behavior I’m seeing?

Hi @christopher.newton!

Thanks for reaching out, and for the great question. The best way we’ve found to handle running Selenium tests is to adjust how the tentacle process runs. Instead of running it as a service, we suggest running it via a logged-in interactive session (so have a user account automatically log in, then run Tentacle.exe on login to invoke the agent). This will give Tentacle full access to create windows and other interactive elements for your tests. We have a blog post about this here: https://octopus.com/blog/ui-testing-considerations - which contains some great suggestions.

I hope this helps, and please don’t hesitate to reach out if you have any further questions.

Best

Thanks for the link. I read the blog post and see that the suggestion is that I run the browser in headless mode, which I am doing. Is there anything else required in the Octopus configuration to get this working?

I’m digging into a potential permissions issue. Based on your blog post, headless mode should be working to I’m going to keep following that and look for other issues.

Was able to get the tests running in headless mode although we’re still not entirely sure why it started working. Thanks for your help!

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.