You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
social-media-poster/Tools/TestSeleniumInstall.ahk

51 lines
1.8 KiB
Plaintext

;---ENVIRONMENT---------------------------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
;DetectHiddenWindows, On
#SingleInstance, Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;SetKeyDelay, 500
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
;#NoTrayIcon
;Menu, Tray, Icon, ..\Icons\ICONNAMEHERE
;---Notes/Extra Info/#Includes------------------------------------------------------
#include %A_ScriptDir%/../Lib/Schrome.ahk ; used for chrome debugging mode connection
;---VARIABLES-----------------------------------------------------------------------
;---MAIN SCRIPT---------------------------------------------------------------------
driver:= ComObjCreate("Selenium.CHROMEDriver") ;Select and Create Chrome driver instance
driver.AddArgument("disable-infobars") ;Hides 'Chrome is being controlled by automated test software' message
driver.AddArgument("--start-maximized") ; Maximize Chrome Browser
driver.AddArgument("--disable-gpu")
;driver.AddArgument("--headless")
try driver.Get("https://freedomain.com/") ;Open selected URL
catch e {
Msgbox,4096,Error, Unable to connect to Chrome.`n`nPlease check the documentation for how to fix this.
ExitApp
}
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
msgbox,4096,Success,If you installed Selenium correctly A chrome window should have opened up and navigated to freedomain.com.`nClick ok to close.
ExitApp
;---FUNCTIONS-----------------------------------------------------------------------