coolooc Posted October 22, 2014 Share Posted October 22, 2014 Hi, I need some help I am trying to using: #Include <Chrome.au3> in order to clicking on button from HTML page by id (id="open-job-dialog-button") in Chrome browser. In Internet explorer its work with the code: $oBtn = _IEGetObjById($oIE,$IdButton) _IEAction($oBtn, "click") The code I write is: #Include <Chrome.au3> local $oBtn2 =_ChromeObjGetHTMLById("open-job-dialog-button") If @error then msgbox(0,"error to get the object by html id",$obtn2) Else msgbox(0,"sucess to get the object by html id",$oBtn2) EndIf I am getting a message with: {"text";"error"} that mean the variable $obtn2 include error value replace to getting some object. In addition I search some function to clcik on the object I suppose to click on Chrome. Please if someone know or worked with this and can help ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #Include <Chrome.au3> include this relavant code: Func _ChromeObjGetHTMLById($objid, $timeout = 5) dim $response = "" $response = _ChromeEval("document.getElementById('" & $objid & "').innerHTML;", $timeout) return $response EndFunc Func _ChromeEval($javascript_expression, $timeout = 5) Dim $response = "" if WinExists("[REGEXPTITLE:.*- Google Chrome]") Then FileDelete($chrome_native_messaging_host_dir & "input.txt") FileWrite($chrome_native_messaging_host_dir & "input.txt", $javascript_expression) $begin = TimerInit() While TimerDiff($begin) < ($timeout * 1000) If FileExists($chrome_native_messaging_host_dir & "output.txt") then ExitLoop sleep(100) WEnd If FileExists($chrome_native_messaging_host_dir & "output.txt") then $response = FileRead($chrome_native_messaging_host_dir & "output.txt") FileDelete($chrome_native_messaging_host_dir & "output.txt") Else SetError(2) EndIf Else SetError(1) EndIf Return $response EndFunc Link to comment Share on other sites More sharing options...
junkew Posted October 22, 2014 Share Posted October 22, 2014 (edited) question 31 https://www.autoitscript.com/wiki/FAQ within iuiautomation you can handle this for all major browsers Edited October 22, 2014 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
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