Skip to content

Timeout issue with Examples function #73

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

Closed
Antexa opened this issue Mar 27, 2020 · 1 comment
Closed

Timeout issue with Examples function #73

Antexa opened this issue Mar 27, 2020 · 1 comment

Comments

@Antexa
Copy link

Antexa commented Mar 27, 2020

I try to run the exemple, no chance from now .

c:\Users\Desktop\selenium-powershell-master\Examples\A-Simple-Google-Search.ps1
1585323599580   mozrunner::runner       INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\\AppData\\Local\\Temp\\rust_mozprofilen8Oa6h"
Exception lors de l'appel de « Until » avec « 1 » argument(s) : « Timed out after 2 seconds »
Au caractère C:\Users\Desktop\selenium-powershell-master\Selenium.psm1:756 : 13
+             $WebDriverWait.Until($Condition)
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebDriverTimeoutException

Also could you please explain me how to run the StartSeChrome cmdlet with the latest chromedriver ?

@Antexa Antexa changed the title Timeout issue Timeout issue with Examples function Mar 27, 2020
itfranck added a commit that referenced this issue Dec 8, 2020
@itfranck
Copy link
Collaborator

itfranck commented Dec 8, 2020

@Antexa I can't help much for the old version as I didn't really use it but with V4 (in pre-release), the example should work properly.

To start the driver

#Chrome 
Start-SeDriver -Browser Chrome -StartURL 'google.com/ncr'
#Firefox 
Start-SeDriver -Browser Firefox -StartURL 'google.com/ncr'

If you want to use a driver more recent than what is included, you will need to download it and specify its location through -WebDriverPath parameter.

Here's the Google example reduced to the minimum amount of lines

Start-SeDriver -Browser Chrome -StartURL 'google.com/ncr'
$Searchbox = Get-SeElement -By Name -value q -Single
Invoke-SeKeys -Element $Searchbox -Keys 'Powershell-Selenium'
Invoke-SeKeys -Element $Searchbox -Keys ([OpenQA.Selenium.Keys]::Enter) -Sleep 2
$LogoImageElement = Get-SeElement -By TagName -Value img -Timeout 10 -Filter {$_.Attributes.src -like '*/logos/*'}
Invoke-SeClick  -Element $LogoImageElement
Stop-SeDriver 

Note that there is documentation now in the Docs folder on each cmdlet which can provide some additional insights.

Also note: For chrome, you can download the latest Driver using: Update-SeDriver -Browser Chrome
Other drivers are not implemented yet

If you have trouble with timeouts, you can add specific -Sleep on the cmdlet prior to the timeout or use Wait-SeElement / Wait-SeDriver.

I am also re-working the Get-SeElement so the default way to get elements is more robust and wait for the elements to be loaded by using a different wait until condition behind the curtain before returning (#193)

Feel free to reopen if you still have issues with this using V4 prerelease.

@itfranck itfranck closed this as completed Dec 8, 2020
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

No branches or pull requests

2 participants