badgerati / monocle Goto Github PK
View Code? Open in Web Editor NEWPowerShell Web Automation module, made to make automating websites easier
License: MIT License
PowerShell Web Automation module, made to make automating websites easier
License: MIT License
Add the feature to take a screenshot of an element using Invoke-MonocoleScreenshot. It seems like in Selenium it would be something like:
#Screenshot of an element
elem = driver.find_element_by_class_name("btn-group")
elem.screenshot('Element.png')
Selenium.WebDriver.ChromeDriver: 85.0.4183.8300
Selenium.WebDriver.GeckoDriver: 0.27.0
Selenium.WebDriver.IEDriver: 3.150.1.2
At the moment you always have to supply a browser to Start-MonocleFlow
, this issue will allow for now browser to be supplied, and for a default (Chrome) to be setup.
Steps to reproduce
Test-MonocleElement -Id "test"
Expected Result
Actual Result
v80 of Chrome is due out soon, so just an issue to prep to update the driver.
This is to add in support for Child/Parent and Sibling elements, plus support for passing a scope element to Get-MonocleElement
- so you can get the parent of an element, and then get and element by on an ID from that parent element, rather than the whole document.
I know Monocle is already on powershellgallery.com, but it's been a while since there's been a new version. If necessary, powershellgallery.com does support pre-release versions. There's been a good chunk of changes since 1.3.4 was first released.
Where it says:
Or, you can take a screenshot directly:
Invoke-MonocoleScreenshot -Name 'screenshot.png' -Path './path'
It should read:
Invoke-MonocleScreenshot
Two new functions:
Get-MonocleElementAttribute
Set-MonocleElementAttribute
The Set will need to use JavaScript
Is there a way to just use the engine somehow to take a screenshot of a website and not opening up the browser itself when using Invoke-MonocleScreenshot?
The Move-MonoclePage
function current moves to a position. This will extend it so you can also pass/pipe an element and Monocle will scroll to it.
Get-MonocleElement -Id 'footer' | Move-MonoclePage
The new v83 chrome driver was released yesterday, so needs bumping up in monocle
This will be simple support, for IE, Firefox and Chrome. But have some Install-MonocleDriver
that will download from nuget a different version of the driver.
Monocle will auto-detect, and use the different driver rather than the normal inbuilt one.
Add Edge support to Monocle, the drivers can be found here.
Legacy is Windows only, Chromium is xplat.
Currently Get-MonocleElementValue
and Set-MonocleElementValue
don't work on dropdowns.
They should be updated to convert the WebElement to a SelectElement if the TagName is select
. With this, we can get the selected value, or set the selected value.
When running scripts in Monocle's Docker container, the Chrome Driver throws "Only works with Version 80".
This sounds like the last version of chrome didn't get installed ๐ค
To populate later, but wait for an element to appear on the page, with a custom Timeout.
You can currently get elements by ID, Tag, Attribute, and XPath. This will add support to get an element by using a JS Selector.
(need to make sure you can safely return an element from JS).
Similar to the likes of Pode, maybe look at also doing proper documentation using mkdocs.
Add a new Move-MonoclePage
to scroll the page - either by a preset, or by a custom amount:
Move-MonoclePage -To Bottom
Move-MonoclePage -Position 1000
When elements are contained within an iframe
, Get-MonocleElement
fails to find the element. In order for Selenium to find these elements, we need to switch context to the iframe
.
To do this a new Enter-MonocleFrame
will be created, this will switch the Selenium context to the iframe
, run a script, and then exit the context back to the parent frame:
Get-MonocleElement -Id 'form-frame' | Enter-MonocleFrame -ScriptBlock {
Get-MonocleElement -Id 'element-in-iframe'
#etc
}
To allow running other possible chromium browsers, allow for a current BinaryPath that can be used when starting chrome. (For like Brave, or Vivaldi).
The version of the chrome driver needs updating to support Chrome v78.0
Hi, Thanks for your cool module.
I'm struggling with ClickElement for clicking the right element in a table.
Could you show the Mpath equivalent for Xpath /html/body/table/tbody/tr[2]/td[2] ?
If you know better ways to do this..this is my html element..much appreciated:
System SetupThere are times when a page will hide certain inputs, only showing it when another input has been completed. In this case, the displaying of the hidden element might happen too slowly, causing Monocle attempt to edit a hidden input.
To get around this, a new Wait-MonocleElementVisible
function will be added. When the element is visible, it will be returned.
Get-MonocleElement -Id 'input' |
Wait-MonocleElementVisible |
Set-MonocleElementValue -Value 'name'
Furthermore, Get-MonocleElement
will have a new -WaitVisible
switch added:
Get-MonocleElement -Id 'input' -WaitVisible | Set-MonocleElementValue -Value 'name'
With there now being more than a handful of functions in Monocle, it's time to add summary comments to the public ones for Description, Parameters, and simple Examples.
Save-MonocleImage doesn't accept the Element parameter from the pipeline where other functions like Set-MonocleElementValue allow it.
This means that the example on the main page gets stuck at the saving the screenshot line.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.