-
Notifications
You must be signed in to change notification settings - Fork 103
ConvertTo-Selenium #175
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
ConvertTo-Selenium #175
Conversation
I like that :)
When ready to merge, please do the following:
- Move the function into the Public folder
- Move the Example.side in the Examples folder
- Remove the import statement at the beginning (L1) and the code after the function (L112-L114)
As for your second point, personally I like the idea of getting it as a ScriptBlock.
That way, you can Call .invoke()
on the result immediately if you want to.
You can also save it / set the clipboard just like a string or array of string.
@ili101 I'll be publishing V4.0 (pre-release) on the gallery tonight. If you are finished by now, let me know and I'll merge your PR. Otherwise, no worries, I'll just release an update whenever it is ready.
The plan is to leave the version as a pre-release for about a month before getting the official release out for real.
That time will allow to collect hopefully more feedback and ensure the release is stable before going forward.
I didn't have the chance to work on it but it will be nice to have it in so we can get some feedback.
I can clean it up now so we can get it in and maybe add more commands support later.
I moved the files and converted to ScriptBlock so now you can do
Import-Module .\Selenium.psd1 $PsCode = ConvertTo-Selenium -Path .\Examples\Example.side # Run directly: . $PsCode # Send to clipboard: $PsCode | Set-Clipboard
Add Invoke-SeClick -Action DoubleClick
and using Switch-SeFrame -Frame $Index
+ Switch-SeFrame -Frame 0
fix.
There is one more line in this example that is not converted correctly:
Get-SeElement -By Id -value "firstname" | Invoke-SeKeys -Keys "${KEY_ENTER}"
In C# it's converted to:
driver.FindElement(By.Id("firstname")).SendKeys(Keys.Enter);
Not sure if you want to add this to Invoke-SeKeys
or Invoke-SeKeyAction
Also I think Invoke-SeKeyAction -Action
is optional but it fails without it, maybe the default action should be sending the key.
@ili101 Ah, I was merging around the same time you published your comment so I missed it.
Note, I removed Invoke-SeKeyAction altogether as the implementation was problematic since we would have needed to have some kind of way to build / perform.
Instead, it is cooked in Invoke-SeKeys so if the keys start with a modifier key, it will do a key down on all the modifier keys, then send the remaining and perform a key up.
So Invoke-SeKeys is the way to go.
Tomblarom
commented
Dec 13, 2022
I discovered an major spelling error, wherefore I get "Cmdlet is not recognized"-Error:
Selenium.psd1
20: FunctionsToExport = @(...'ConvertTo-SeSelenium'...)
Selenium.psm1
160: function ConvertTo-Selenium { ...
Version: 4.0.0-preview3 from PS-Gallery
feature request #84
Convert Selenium IDE .side recording file to PowerShell commands.
I implemented this basic commends:
If a command is missing it will be added as a comment.
output example: