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

  • Developers
Posted

What is the total error you get including the  line?

au3stripper has the /mo option that will generate a single total source file so you can check that error linenumber.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Hi @julianfazri 👋 ,

my recommendation is: start with this boilerplate template (mine). In case you still have problems to quick start with WebDriver, let us know and show us the console output which will be created when you start main.au3. Cheers.

Best regards
Sven

==> AutoIt related: 🔗 Organization AutoIt Community🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet🔗 autoit-webdriver-boilerplate

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

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
×
×
  • Create New...