Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] Use selenium manager in tests #11871

Merged
merged 13 commits into from
Apr 19, 2023
Merged

[dotnet] Use selenium manager in tests #11871

merged 13 commits into from
Apr 19, 2023

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Apr 6, 2023

Thanks for contributing to Selenium!
Related to #11304

Now it's not necessary to store driver binaries on machine where tests are executing, Selenium Manager does it.

To tests these changes: remove c:\Projects\WebDriverServers\ directory and tests should be passed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@titusfortner
Copy link
Member

Oh nice, this was annoying. If the tests are passing....

@nvborisenko
Copy link
Member Author

1 test failed:

Failed ShouldBeAbleToUploadTheSameFileTwice [468 ms]
  Error Message:
   OpenQA.Selenium.NoSuchElementException : Unable to locate element: #upload
  Stack Trace:
     at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 703
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 576
   at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 308
   at OpenQA.Selenium.By.<.ctor>b__11_0(ISearchContext context) in D:\a\selenium\selenium\dotnet\src\webdriver\By.cs:line 71
   at OpenQA.Selenium.By.FindElement(ISearchContext context) in D:\a\selenium\selenium\dotnet\src\webdriver\By.cs:line 336
   at OpenQA.Selenium.WebDriver.FindElement(By by) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 294
   at OpenQA.Selenium.FormHandlingTests.ShouldBeAbleToUploadTheSameFileTwice() in D:\a\selenium\selenium\dotnet\test\common\FormHandlingTests.cs:line 216

Can somebody re-trigger tests again, just to understand whether it's flaky. BTW it is passing locally.

@nvborisenko
Copy link
Member Author

Retriggered by myself.

Failed ShouldBeAbleToUploadTheSameFileTwice [441 ms]
  Error Message:
   OpenQA.Selenium.NoSuchElementException : Unable to locate element: #upload
  Stack Trace:
     at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 703
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 576
   at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 308
   at OpenQA.Selenium.By.<.ctor>b__11_0(ISearchContext context) in D:\a\selenium\selenium\dotnet\src\webdriver\By.cs:line 71
   at OpenQA.Selenium.By.FindElement(ISearchContext context) in D:\a\selenium\selenium\dotnet\src\webdriver\By.cs:line 336
   at OpenQA.Selenium.WebDriver.FindElement(By by) in D:\a\selenium\selenium\dotnet\src\webdriver\WebDriver.cs:line 294
   at OpenQA.Selenium.FormHandlingTests.ShouldBeAbleToUploadTheSameFileTwice() in D:\a\selenium\selenium\dotnet\test\common\FormHandlingTests.cs:line 216

Now it is failing twice (per 2 target framework).

What is changed:

  • geckodriver now is the latest

Any clues?

@titusfortner
Copy link
Member

I think I've seen it before. Likely a timing issue? It's not going to be related to this PR at least.

@nvborisenko
Copy link
Member Author

This is what I see when reproduced the issue sporadically.

image

@diemol
Copy link
Member

diemol commented Apr 8, 2023

I'll test this locally because Selenium Manager is not used in GitHub actions. The runner has drivers on the path.

@nvborisenko
Copy link
Member Author

nvborisenko commented Apr 8, 2023

I tested it locally, I have no driver in %PATH%, selenium manager is used. Moreover I fixed flaky test.

Next step is remove drivers from PATH in GitHub actions? Here I am asking help, because I am not sure where exactly drivers are copied in workflow.

@titusfortner
Copy link
Member

What is installed on the runners can be found in this repo — https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md#environment-variables-1

@titusfortner
Copy link
Member

We should figure out how to remove the directory from PATH or see if we can delete the driver itself.

@nvborisenko
Copy link
Member Author

You are right, there is CHROMEWEBDRIVER env var, and also the drivers are defined in PATH env. I am going to delete drivers physically from drive C:

@nvborisenko
Copy link
Member Author

nvborisenko commented Apr 11, 2023

All done, driver are physically deleted. Tests passed.

VERBOSE: Performing the operation "Remove Directory" on target "C:\SeleniumWebDrivers\ChromeDriver".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\ChromeDriver\chromedriver.exe".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\ChromeDriver\LICENSE.chromedriver".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\ChromeDriver\versioninfo.txt".
VERBOSE: Performing the operation "Remove Directory" on target "C:\SeleniumWebDrivers\EdgeDriver".
VERBOSE: Performing the operation "Remove Directory" on target "C:\SeleniumWebDrivers\EdgeDriver\Driver_Notes".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\EdgeDriver\Driver_Notes\credits.html".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\EdgeDriver\Driver_Notes\EULA".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\EdgeDriver\Driver_Notes\LICENSE".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\EdgeDriver\msedgedriver.exe".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\EdgeDriver\versioninfo.txt".
VERBOSE: Performing the operation "Remove Directory" on target "C:\SeleniumWebDrivers\GeckoDriver".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\GeckoDriver\geckodriver.exe".
VERBOSE: Performing the operation "Remove File" on target "C:\SeleniumWebDrivers\GeckoDriver\versioninfo.txt".

@titusfortner titusfortner added this to the 4.9 milestone Apr 18, 2023
@diemol
Copy link
Member

diemol commented Apr 19, 2023

My apologies, @nvborisenko, I made changes in SeleniumManager that caused the conflict. Would you be able to fix it whenever you get some time? Thank you.

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @nvborisenko!

@diemol diemol merged commit 5055da9 into SeleniumHQ:trunk Apr 19, 2023
13 checks passed
dev-ardi pushed a commit to dev-ardi/selenium that referenced this pull request Apr 24, 2023
* Copy manager binaries to tests output

* Use selenium manager implicitly to execute tests

* Trigger tests again

* Revert "Trigger tests again"

This reverts commit 6dde845.

* Fix flaky ShouldBeAbleToUploadTheSameFileTwice tests

* Remove preinstalled drivers

* Remove all known pre-installed drivers

* Damn powershell

* Print verbose messages while deleting drivers

* Return back globalization namespace

---------

Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants