Jump to content

Recommended Posts

Posted

Hi All,

I am new with AutoIt. I want to create a simple script to open specific site on browser using web driver, but I got error line with "Error: Unknown function name" message, but I don't know which line from my au3. I put the code below, I hope you can help me tho solved this.

; ONLY FOR DEMO USE
; Created to work with SPS 6.12 or later where multiple authentication backends are configured.
;
; Compile with Aut2exe to ensure the include files are added too
; cmd line arguments for launcher: OI-SG-RemoteApp-Launcher.exe --cmd <path>\web_SPS_local_user.exe --args "{username} {password} {asset}"

Opt("TrayAutoPause", 0)
Opt("TrayIconDebug", 0)

;#include <MsgBoxConstants.au3>

#include 'webdriver\wd_core.au3'
#include 'webdriver\wd_helper.au3'

Local $asset = $CmdLine[1]

; Configure domain suffix for the asset the user is navigating to
;Local $domainSuffix = '.oneidentity.demo'

Local $sDesiredCapabilities, $sSession

; We use Chrome in this script. For other browsers lookup the functions below.
SetupChrome()

_WD_Startup()


$sSession = _WD_CreateSession($sDesiredCapabilities)

; Hide the WebDriver console
_WD_ConsoleVisible(false)

; Navigate to asset website
_WD_Navigate($sSession, 'https://' & $asset)

Func SetupGecko()
    _WD_Option('Driver', 'webdriver\geckodriver.exe')
    _WD_Option('DriverParams', '--log trace')
    _WD_Option('Port', 4444)

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}'

EndFunc   ;==>SetupGecko

Func SetupChrome()
    _WD_Option('Driver', 'webdriver\chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

   ; Add chromeOption to not offer saving credentials
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "prefs": { "credentials_enable_service": false, "profile": { "password_manager_enabled": false}}} }}}'

EndFunc   ;==>SetupChrome

Func SetupEdge()
    _WD_Option('Driver', 'webdriver\msedgedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"excludeSwitches": [ "enable-automation"]}}}}'
EndFunc   ;==>SetupEdge

 

Thanks.

Regards,

Julian

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...