All Projects → Badgerati → Monocle

Badgerati / Monocle

Licence: MIT license
PowerShell Web Automation module, made to make automating websites easier

Programming Languages

powershell
5483 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to Monocle

pyderman
Install Selenium-compatible Chrome/Firefox/Opera/PhantomJS/Edge webdrivers automatically.
Stars: ✭ 24 (-48.94%)
Mutual labels:  selenium, edge
Object Fit Images
🗻 Polyfill object-fit/object-position on <img>: IE9, IE10, IE11, Edge, Safari, ...
Stars: ✭ 2,050 (+4261.7%)
Mutual labels:  edge, ie
history-of-ie-incompatible-sites-list
History of IE incompatible sites list provided by Microsoft to redirect from IE11 to Chromium Edge
Stars: ✭ 29 (-38.3%)
Mutual labels:  edge, ie
Edge Selenium Tools
An updated EdgeDriver implementation for Selenium 3 with newly-added support for Microsoft Edge (Chromium).
Stars: ✭ 41 (-12.77%)
Mutual labels:  selenium, edge
frontend testing
Repository containing sample code used in a Frontend Testing workshop
Stars: ✭ 14 (-70.21%)
Mutual labels:  selenium
pinterest-web-scraper
Scraping Visually Similar Images from Pinterest
Stars: ✭ 26 (-44.68%)
Mutual labels:  selenium
TRA-Ticket-Booker
(已不適用新版臺鐵訂票系統,且不再更新)台灣鐵路訂票應用程式(臺鐵 / 台鐵 / 訂單程票 / 訂來回票),基於 Selenium + PyQt4。
Stars: ✭ 26 (-44.68%)
Mutual labels:  selenium
selenium-cheatsheet-java
A comprehensive list of selenium commands in Java
Stars: ✭ 20 (-57.45%)
Mutual labels:  selenium
telenium
Automation for Kivy Application
Stars: ✭ 56 (+19.15%)
Mutual labels:  selenium
alfred-browser-tabs
🔍 Search browser tabs from Chrome, Brave, Safari, etc..
Stars: ✭ 302 (+542.55%)
Mutual labels:  edge
fBrowser
Helpful Selenium functions to make web-scraping easier and faster
Stars: ✭ 16 (-65.96%)
Mutual labels:  selenium
java-e2e-test-example
An complete example of a pipeline focusing on API and UI (mobile and web) tests.
Stars: ✭ 18 (-61.7%)
Mutual labels:  selenium
justtestlah
Dynamic test framework for web and mobile applications
Stars: ✭ 43 (-8.51%)
Mutual labels:  selenium
Fifa21-Autobidder
Selenium-based bot that autobids and autobuys players on FIFA 23 Ultimate Team's transfer market
Stars: ✭ 106 (+125.53%)
Mutual labels:  selenium
scrape-youtube-channel-videos-url
This Python script is used to scrape all the video links from a youtube channel.
Stars: ✭ 34 (-27.66%)
Mutual labels:  selenium
web-image-crawler
Code to download web-images
Stars: ✭ 15 (-68.09%)
Mutual labels:  selenium
phoenix.webui.framework
基于WebDriver的WebUI自动化测试框架
Stars: ✭ 118 (+151.06%)
Mutual labels:  selenium
Python-Studies
All studies about python
Stars: ✭ 56 (+19.15%)
Mutual labels:  selenium
TypeEdge
TypeEdge is a strongly-typed development experience for Azure IoT Edge.
Stars: ✭ 15 (-68.09%)
Mutual labels:  edge
MasterSeleniumFramework
Automation Testing | Web | Java | OOPS | Selenium WebDriver | TestNG | Maven | ExtentReport | Allure Reports | Java mail API | Design Patterns (Page Object Model, Singleton) | Jenkins | Data-Driven Testing using JSON file
Stars: ✭ 52 (+10.64%)
Mutual labels:  selenium

Monocle

MIT licensed PowerShell Docker

Monocle is a Cross-Platform PowerShell Web Automation module, made to make automating and testing websites easier. It's a PowerShell wrapper around Selenium, with the aim of abstracting Selenium away from the user.

Monocle currently supports the following browsers:

  • IE (v3.150.1.2)
  • Chrome (v85.0.4183.8300)
  • Firefox (driver: v0.27.0)
  • Edge (driver: v81.0.416.77)
  • EdgeLegacy (driver: v17.17134)

Install

Install-Module -Name Monocle

Example

Import-Module Monocle

# create a browser
$browser = New-MonocleBrowser -Type Chrome

# Monocle runs commands in web flows, for easy disposal and test tracking
Start-MonocleFlow -Name 'Load YouTube' -Browser $browser -ScriptBlock {

    # tell the browser which URL to navigate to, will wait for the page to load
    Set-MonocleUrl -Url 'https://www.youtube.com'

    # sets the element's value, selecting the element by ID/Name
    Get-MonocleElement -Id 'search_query' | Set-MonocleElementValue -Value 'Beerus Madness (Extended)'

    # click the search button
    Get-MonocleElement -Id 'search-icon-legacy' | Invoke-MonocleElementClick

    # wait for the URL to change to start with the following value
    Wait-MonocleUrl -Url 'https://www.youtube.com/results?search_query=' -StartsWith

    # downloads an image from the page, selcted by using an XPath to an element
    Get-MonocleElement -XPath "//div[@data-context-item-id='SI6Yyr-iI6M']/img[1]" | Save-MonocleImage -FilePath '.\beerus.jpg'

    # tells the browser to click the video in the results
    Get-MonocleElement -XPath "//a[@title='Dragon Ball Super Soundtrack - Beerus Madness (Extended)']" | Invoke-MonocleElementClick

    # wait for the URL to be loaded
    Wait-MonocleUrl -Url 'https://www.youtube.com/watch?v=SI6Yyr-iI6M'

}

# dispose the browser
Close-MonocleBrowser -Browser $browser

Documentation

Functions

The following is a list of available functions in Monocle:

  • Add-MonocleElementClass
  • Assert-MonocleBodyValue
  • Assert-MonocleElementValue
  • Clear-MonocleElementValue
  • Close-MonocleBrowser
  • Edit-MonocleUrl
  • Enter-MonocleFrame
  • Get-Monocle2FACode
  • Get-MonocleElement
  • Get-MonocleElementAttribute
  • Get-MonocleElementChild
  • Get-MonocleElementCSS
  • Get-MonocleElementParent
  • Get-MonocleElementSibling
  • Get-MonocleElementValue
  • Get-MonocleHtml
  • Get-MonoclePageSize
  • Get-MonocleTimeout
  • Get-MonocleUrl
  • Install-MonocleDriver
  • Invoke-MonocleElementCheck
  • Invoke-MonocleElementClick
  • Invoke-MonocleJavaScript
  • Invoke-MonocleRetryScript
  • Invoke-MonocleScreenshot
  • Measure-MonocleElement
  • Measure-MonocleElementChild
  • Move-MonoclePage
  • New-MonocleBrowser
  • Remove-MonocleElementClass
  • Remove-MonocleElementCSS
  • Restart-MonocleBrowser
  • Save-MonocleImage
  • Set-MonocleElementAttribute
  • Set-MonocleElementCSS
  • Set-MonocleElementValue
  • Set-MonocleTimeout
  • Set-MonocleUrl
  • Start-MonocleFlow
  • Start-MonocleSleep
  • Submit-MonocleForm
  • Test-MonocleElement
  • Test-MonocleElementAttribute
  • Test-MonocleElementChecked
  • Test-MonocleElementChild
  • Test-MonocleElementClass
  • Test-MonocleElementCSS
  • Test-MonocleElementVisible
  • Wait-MonocleElement
  • Wait-MonocleElementVisible
  • Wait-MonocleUrl
  • Wait-MonocleUrlDifferent
  • Wait-MonocleValue

Custom Drivers

If you need to use an earlier/later version of a driver, you manually download the driver and then supply a -Path to New-MonocleBrowser which is the directory that contains the driver.

New-MonocleBrowser -Type Chrome -Path 'C:\Drivers\Chrome\70.0.3156.0'

Also, you could use Install-MonocleDriver. This will download a driver for you, and be automatically used by Monocle. This does require the nuget CLI being installed.

Screenshots

There are two main ways to take a screenshot of the browser. The first it to tell Monocle to automatically take a screenshot whenever a flow fails. You can do this by using the -ScreenshotPath and -ScreenshotOnFail parameters on the Start-MonocleFlow function:

Start-MonocleFlow -Name '<name>' -Browser $browser -ScriptBlock {
    # failing logic
} -ScreenshotPath './path' -ScreenshotOnFail

Or, you can take a screenshot directly:

Invoke-MonocleScreenshot -Name 'screenshot.png' -Path './path'

Not supplying -ScreenshotPath or -Path will default to the current path.

2FA Codes

Monocle has inbuilt support for generating 2FA codes. To do this you need the Secret Code that is normally presented with the QR code, and you pass this to the Get-Monocle2FACode function with a date - which is defaulted to now:

$code = Get-Monocle2FACode -Secret 'FAKENDMYJWLLB'
Get-MonocleElement -Id '2fa-code' | Set-MonocleElementValue -Value $code -Mask

Docker

Monocle has an official Docker image, which comes preloaded with:

  • Monocle (obviously!)
  • Firefox
  • Google Chrome

You can use this image to run your Monocle flows - and they will also automatically run headless.

An example Dockerfile could be:

FROM badgerati/monocle:latest
COPY . /usr/src/scripts
CMD [ "pwsh", "-c", "cd /usr/src/scripts; ./flow.ps1" ]

The you can build and run the image as follows:

docker build -t monocle/test .
docker run --rm monocle/test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].