ipjohnson / SeleniumFixture

Selenium testing fixture for C#
Microsoft Public License
15 stars 6 forks source link

ChromeDriverAttribute time out #9

Open pbolduc opened 6 years ago

pbolduc commented 6 years ago

I have a long running test which times out after 60 seconds with this error:

The HTTP request to the remote WebDriver server for URL http://localhost:16051/session/65a753f16ca91b2035f4564f44781fb4/execute timed out after 60 seconds.

The ChromeDriver class supports a commandTimeout parameter. Adding an extra overload on ChromeDriverAttribute that supports specifying a time out would solve the problem.

 public ChromeDriver(string chromeDriverDirectory, ChromeOptions options, TimeSpan commandTimeout)

TimeSpan is not a valid parameter in an attribute, so I would suggest an integer representing the number of seconds. For example,

[ChromeDriver(commandTimeout=300)]

I can supply a pull request.

ipjohnson commented 6 years ago

I'd definitely be up for a PR.

pbolduc commented 6 years ago

To keep driver parity, I will extend this issue to the other drivers. Will just take a bit more testing on my part.

ipjohnson commented 6 years ago

Moving forward I'm going to upgrade the projects to selenium 3.7, are you interested in moving up to 3.7 or is it more useful for you to release against the 2.X series?

This move would include retargeting to .netstandard 2.0 and .net 4.5

pbolduc commented 6 years ago

I did have an issue when I opened the solution. It wanted to upgrade the dnx project. When I committed my initial changes, I avoided committing the changes to the unrelated files.

I think it is good idea to update to the latest selenium version. We should keep that as a separate issue.

pbolduc commented 6 years ago

I just pushed a commit on my fork related to being able to specify a command timeout when using the WebDriverAttribute types. Originally, I added overload on the browser specific attributes, ie ChromeDriverAttribute, however, if you are adding a timeout you probably want it applied to every browser.

I have added WebDriverCommandTimeoutAttribute and check for that inside browser specific attributes. For now, my change only is implemented for Chrome. This would also allow a custom driver provider to also look for the timeout attribute and configure the driver command timeout.

Looking for feedback. If it looks good, I will go through the other driver attributes and implement the changes.

ipjohnson commented 6 years ago

I agree WebDriverCommandTimeoutAttribute is the right way to go. It looks good.