lapoelkan12 0 Posted July 5 Share Posted July 5 Hi , i try to insert in input box of google somthing , for learn , i create this script but when i run it , return blank element why ?? expandcollapse popup#include <ButtonConstants.au3> #include <ColorConstants.au3> #include <Date.au3> #include <Debug.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; non standard UDF's #include "wd_helper.au3" #include "wd_capabilities.au3" Global $sDesired,$sCapabilities,$sSession Local $sCapabilities = SetupGecko() Local $iWebDriver_PID = _WD_Startup() If @error <> $_WD_ERROR_Success Then Exit -1 EndIf $sSession = _WD_CreateSession($sCapabilities) _WD_Navigate($sSession, "https://www.google.com") _WD_LoadWait($sSession) Sleep(3000) ;$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='username']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='q']") MsgBox(0,'',$sElement) ;_WD_DeleteSession($sSession) ;_WD_Shutdown() Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) ;~ Local $sCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'firefox') _WD_CapabilitiesAdd('browserName', 'firefox') _WD_CapabilitiesAdd('acceptInsecureCerts', True) ;If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless') _WD_CapabilitiesDump(@ScriptLineNumber) ; dump current Capabilities setting to console - only for testing in this demo Local $sCapabilities = _WD_CapabilitiesGet() Return $sCapabilities EndFunc ;==>SetupGecko Link to post Share on other sites
Danp2 1,277 Posted July 5 Share Posted July 5 It would be helpful to see the complete console output (post it the same way you posted the code above) WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now