junkew Posted May 17, 2019 Share Posted May 17, 2019 See faq31 for alternatives 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...
Letraindusoir Posted October 18, 2019 Share Posted October 18, 2019 Can Guicreateobj be embedded in the Chrome-browser-webpage like embedded IE-webpage? Link to comment Share on other sites More sharing options...
junkew Posted October 18, 2019 Share Posted October 18, 2019 I assume you can not sure if anybody tried CEF https://github.com/chromiumembedded/cef 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...
samibb Posted April 2, 2020 Share Posted April 2, 2020 Hi i am using Google Chrome Version 80.0.3987.162 (Official Build) (64-bit) i loaded AutoIT for Google Chrome 1.0 ID: leakmpklghcpopcfgkkjjfhmlkhocjlj Inspect viewsbackground page Enabled checkbox next to AutoIT for Google Chrome is checked. Also make sure the Allow access to file URLs box is checked and DOWNLOAD : Latest Version - v0.5 (29/09/13) Chrome.au3 when i run example chrome_example.au3 and chrome_example_2.au3 i work but no result on ConsoleWrite nothing at all. Can any one help? Link to comment Share on other sites More sharing options...
zeenmakr Posted April 8, 2020 Share Posted April 8, 2020 On 4/2/2020 at 9:54 AM, samibb said: i am using Google Chrome Version 80.0.3987.162 (Official Build) (64-bit) ... when i run example chrome_example.au3 and chrome_example_2.au3 i work but no result on ConsoleWrite nothing at all. Can any one help? has the issue been resolved? so scripts filled out all the input into chrome page okay but you see nothing in SciTE debugging window? chrome_example.au3 - submission page is broken ( 505 Error ) therefore is no return 'Thank You' Page to retrieve info so you should see error output like these. _ChromeObjGetHTMLByTagName("h1") = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 1) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 2) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 3) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 4) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 5) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 6) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 7) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 8) = Cannot read property 'innerHTML' of undefined _ChromeObjGetHTMLByTagName("p", 9) = Cannot read property 'innerHTML' of undefined chrome_example_2.au3 - since this is offline page and it doesn't submit anything it tries to retreive the info that random generated like so. _ChromeObjGetPropertyByName("ExampleForm", "method") = post _ChromeObjGetValueByName("hiddenExample") = secret value _ChromeObjSetValueByName("textExample", _RandomText(10)) = FZFMHWHAHN _ChromeObjGetValueByName("textExample") = FZFMHWHAHN _ChromeObjSetValueByName("passwordExample", _RandomText(10)) = YNHBZQBMIU _ChromeObjGetValueByName("passwordExample") = YNHBZQBMIU _ChromeObjGetPropertyByName("fileExample", "type") = file _ChromeObjGetPropertyByName("imageExample", "src") = http://www.autoitscript.com/images/autoit_6_240x100.jpg _ChromeObjGetHTMLById("messages") = Form Submitted!<br> _ChromeObjSetValueByName("textareaExample", _RandomText(10)) = FFXBTBRTZU _ChromeObjGetValueByName("textareaExample") = FFXBTBRTZU _ChromeObjGetPropertyByName("checkboxG1Example", "checked") = true _ChromeObjGetPropertyByName("checkboxG2Example", "checked") = false _ChromeObjGetPropertyByName("radioExample", "checked", 0) = true _ChromeObjGetPropertyByName("selectExample", "selectedIndex") = 1 _ChromeObjGetPropertyByName("multipleSelectExample", "selectedIndex") = 1 _ChromeObjGetHTMLById("messages") = Form Submitted!<br>Form Submitted!<br> Link to comment Share on other sites More sharing options...
zeenmakr Posted April 8, 2020 Share Posted April 8, 2020 Just case someone is wondering whether I edited the output. changes were made in Chrome.au3 functions. Because $response returns as '{"text":"some string"}', regex was used to return just 'some string' ;~ modified from return $response ;~ to return StringRegExpReplace($response, '\{\".+\":\"(.+)\"\}$', '$1') As pointed out earlier, function _ChromeDocWaitForReadyStateCompleted() fails and exit on timeout, culprit is StringCompare() fails at least on my end win8os/autoit 3.3.14.5 ;~ fixed from Until @error > 0 Or StringLen($response) = 0 or StringCompare($response, "complete") = 0 ;~to Until @error > 0 Or StringLen($response) = 0 or StringCompare($response, '{"text":"complete"}') = 0 Link to comment Share on other sites More sharing options...
zeenmakr Posted April 9, 2020 Share Posted April 9, 2020 Quote ...StringCompare() fails at least on my end... on the topic of Chrome.au3, i'm wondering what's this function returns back in 2013 but StringCompare() in 2020 returns exact string match with option of case-sensitivities . Suggest to modify all StringCompare() to example showed above or switch to StringInStr() or StringRegExp() in place of it. (note: the check statement required attention as return for each suggested function is different) Link to comment Share on other sites More sharing options...
samibb Posted April 15, 2020 Share Posted April 15, 2020 thank you for previous notes, and it is working for normal pages >>>> Window INFO <<<< Title: Chrome UDF - Page 7 - AutoIt Example Scripts - AutoIt Forums - Google Chrome Class: Chrome_WidgetWin_1 Position: -8, -8 Size: 1936, 1056 Style: 0x17CF0000 ExStyle: 0x00000100 Handle: 0x00000000004D06EC >>>> Control <<<< Class: Chrome_RenderWidgetHostHWND Instance: 1 ClassnameNN: Chrome_RenderWidgetHostHWND1 Name: Advanced (Class): [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1] ID: 890826400 Text: Chrome Legacy Window Position: 0, 111 Size: 1920, 937 ControlClick Coords: 308, 318 Style: 0x56300000 ExStyle: 0x00000020 Handle: 0x0000000000150636 >>>> Mouse <<<< Position: 316, 429 Cursor ID: 0 Color: 0xFAFAFA >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Chrome Legacy Window >>>> Hidden Text <<<< Chrome Legacy Window but not working with this page PRD(PRODUCTION) - Google Chrome Link to comment Share on other sites More sharing options...
zeenmakr Posted April 23, 2020 Share Posted April 23, 2020 Quote ...it is working for normal pages ... but not working with this page Could you be more specific? What is a normal pages and what is this page? how is the window info you provided relevant? So you get the examples provided working? are these the 'normal pages' you referring to? Link to comment Share on other sites More sharing options...
samibb Posted April 30, 2020 Share Posted April 30, 2020 (edited) 1- dose autoit work with VPN web sit? 2-this page come via VPN 3- by the way i used ID 4- all objects with no name only ID and chrome functions are by name is there more function using ID instead of names. 5- is there new update for AutoIt working with chrome because microsoft not supporteing Explorer any more. please my brain will blow Edited May 2, 2020 by samibb Link to comment Share on other sites More sharing options...
zeenmakr Posted May 6, 2020 Share Posted May 6, 2020 Quote 4- all objects with no name only ID and chrome functions are by name is there more function using ID instead of names. All functions in Chrome.au3 are just wrappers, you can create your own functions. It uses Javascript. Just open up Chrome.au3 look through a few of existing functions then you will quickly realized that _ChromeEval() is your friend. Here is quick example to get you started. 2 new functions created bellow to get and set value by id: _ChromeObjSetValueById('id', 'string') & _ChromeObjGetValueById('id') you can copy and paste them to Chrome.au3 expandcollapse popup#include <Chrome.au3> ; ----------------------- ; test site: www.bing.com ; ----------------------- _ChromeStartup('http://bing.com') _ChromeDocWaitForReadyStateCompleted() Local $currTabTitle = 'Bing' _ChromeDocWaitForExistenceByTitle($currTabTitle) Local $IsNotActive = @error ConsoleWrite(($IsNotActive = 0) ? $IsNotActive &" - SUCCESS! Found: "& $currTabTitle&@CRLF : $IsNotActive &" - FAILED! NOT Found: "& $currTabTitle&@CRLF) If $IsNotActive Then MsgBox(0, $IsNotActive&' | Title Status', 'Not Found: '&$currTabTitle) Else $_IsPageReady = _ChromeDocWaitForReadyStateCompleted() If $_IsPageReady Then MsgBox(0, $IsNotActive&' | Page Status: '&$_IsPageReady, 'success, ok to get html') $_SearchInput = _ChromeObjGetHTMLById('sb_form') MsgBox(0, 'id=sb_form', $_SearchInput) _ChromeObjSetValueById('sb_form_q', 'samibb string') $_SearchInput = _ChromeObjGetValueById('sb_form_q') MsgBox(0, 'id=sb_form_q', $_SearchInput) Else MsgBox(0, $IsNotActive&' | Page Status: '&$_IsPageReady, 'try again, failed to load page') EndIf EndIf Exit ; ======================================================================================== ; ======================================================================================== Func _ChromeObjSetValueById($objId, $value, $timeout = 5) dim $response = "" if StringLen($value) < 1 Then $value = "Missing $value" $response = _ChromeEval("document.getElementById('" & $objId & "').value = '" & $value & "';", $timeout) SetError(@error) return StringRegExpReplace($response, '\{\".+\":\"(.+)\"\}$', '$1') EndFunc ; ======================================================================================== ; ======================================================================================== Func _ChromeObjGetValueById($objid, $timeout = 5) dim $response = "" $response = _ChromeEval("document.getElementById('" & $objid & "').value;", $timeout) return StringRegExpReplace($response, '\{\".+\":\"(.+)\"\}$', '$1') EndFunc Quote 5- is there new update for AutoIt working with chrome because microsoft not supporteing Explorer any more. If you are referring to other UDFs then you might also want to look into UIAutomation and WebDriver. Link to comment Share on other sites More sharing options...
samibb Posted May 6, 2020 Share Posted May 6, 2020 Many thanks Link to comment Share on other sites More sharing options...
samibb Posted May 6, 2020 Share Posted May 6, 2020 _ChromeObjGetHTMLById this function working _ChromeObjSetValueById Not working _ChromeObjSetValueById('tbxTktNumberId', '065') not working . the obj is in table. any ideas please Link to comment Share on other sites More sharing options...
zeenmakr Posted May 7, 2020 Share Posted May 7, 2020 Quote _ChromeObjSetValueById('tbxTktNumberId', '065') not working Did you get the example above working? and what is the website url you having trouble with? Link to comment Share on other sites More sharing options...
zeenmakr Posted May 7, 2020 Share Posted May 7, 2020 as pointed out earlier. here is the javascript HTML DOM document that you can use to create your own functions if needs be. https://www.w3schools.com/js/js_htmldom_elements.asp test and check what works for you Local $objId = 'idName' Local $index = 0 ;<--the order of id that it in, if multiple ids present Local $value = 'new string' Local $timeout = 5 ;<--in second _ChromeDocWaitForReadyStateCompleted() ;try this _ChromeEval("document.getElementsById('" & $objId & "')[" &$index& "].value = '" & $value & "';", $timeout) ;<---multiple ids present ;if it doesn't work try this _ChromeEval("document.getElementsById('" & $objId & "')[" &$index& "].innerHTML = '" & $value & "';", $timeout) ;<---multiple ids present ;OR _ChromeDocWaitForReadyStateCompleted() ;try this _ChromeEval("document.getElementById('" & $objId & "').value = '" & $value & "';", $timeout) ;<--only one unique id present ;if it doesn't work try this _ChromeEval("document.getElementById('" & $objId & "').innerHTML = '" & $value & "';", $timeout) ;<--only one unique id present ;if everything failed, then try other Javascript HTML DOM Methods from document above Method Description document.getElementById(id) Find an element by element id document.getElementsByTagName(name) Find elements by tag name document.getElementsByClassName(name) Find elements by class name ect.. Link to comment Share on other sites More sharing options...
zeenmakr Posted May 7, 2020 Share Posted May 7, 2020 (edited) update: hope you can spot the different between .value and .innerHTML expandcollapse popup#include <Chrome.au3> ; ----------------------- ; test #1 site: www.bing.com ; ----------------------- ;~ $testSite = 'bing' ;~ Local $currTabTitle = 'Bing' ;bing.com ;~ _ChromeStartup('http://bing.com') ; ----------------------- ; test #2 site: vpn.saudia.com ; ----------------------- $testSite = 'saudia' Local $currTabTitle = 'Welcome to SSL VPN' ;vpn.saudia.com _ChromeStartup('https://vpn.saudia.com/') _ChromeDocWaitForReadyStateCompleted(30) _ChromeDocWaitForExistenceByTitle($currTabTitle) Local $IsNotActive = @error ConsoleWrite(($IsNotActive = 0) ? $IsNotActive &" - SUCCESS! Found: "& $currTabTitle&@CRLF : $IsNotActive &" - FAILED! NOT Found: "& $currTabTitle&@CRLF) If $IsNotActive Then MsgBox(0, $IsNotActive&' | Title Status', 'Not Found: '&$currTabTitle) Else $_IsPageReady = _ChromeDocWaitForReadyStateCompleted() If $_IsPageReady Then MsgBox(0, $IsNotActive&' | Page Status: '&$_IsPageReady, 'success, ok to get/set html') ; ----------------------- ; test #1 site: www.bing.com ; ----------------------- If $testSite == 'bing' Then $_innerHtml = _ChromeObjGetHTMLById('sb_form') ;This works (innerHTML) MsgBox(0, 'innerHTML | id=sb_form', $_innerHtml) _ChromeObjSetValueById('sb_form_q', 'samibb string') Sleep(500) _ChromeDocWaitForReadyStateCompleted(30) $_value = _ChromeObjGetValueById('sb_form_q') ;This works (value) <--see and compare vpn.saudia.com example bellow MsgBox(0, 'value | id=sb_form_q', $_value) $_innerHTML = _ChromeObjGetHTMLById('sb_form_q') ;But this is NOT working (innerHTML) MsgBox(0, 'innerHTML | id=sb_form_q', $_innerHTML) EndIf ; ----------------------- ; test #2 site: vpn.saudia.com ; ----------------------- If $testSite == 'saudia' Then _ChromeObjSetValueById('username', 'samibb') _ChromeObjSetValueById('credential', 'samibbpassword') _ChromeInputClickByName("login_button") ;_ChromeInputClickById("login_button") ;_ChromeInputClickByType("button") Sleep(500) _ChromeDocWaitForReadyStateCompleted(30) $loginStatus_value = _ChromeObjGetValueById('err_val') ;This is NOT working (value) MsgBox(0, 'value | id=err_val', $loginStatus_value) $loginStatus_innerHTML = _ChromeObjGetHTMLById('err_val') ;but this works (innerHTML) <---see and compare bing.com example above MsgBox(0, 'innerHTML | id=err_val', $loginStatus_innerHTML) EndIf Else MsgBox(0, $IsNotActive&' | Page Status: '&$_IsPageReady, 'try again, failed to load page') EndIf EndIf Exit ; ======================================================================================== ; ======================================================================================== Func _ChromeObjSetValueById($objId, $value, $timeout = 5) dim $response = "" if StringLen($value) < 1 Then $value = "Missing $value" $response = _ChromeEval("document.getElementById('" & $objId & "').value = '" & $value & "';", $timeout) SetError(@error) return StringRegExpReplace($response, '\{\".+\":\"(.+)\"\}$', '$1') EndFunc ; ======================================================================================== ; ======================================================================================== Func _ChromeObjGetValueById($objid, $timeout = 5) dim $response = "" $response = _ChromeEval("document.getElementById('" & $objid & "').value;", $timeout) return StringRegExpReplace($response, '\{\".+\":\"(.+)\"\}$', '$1') EndFunc ; ======================================================================================== ; ======================================================================================== Func _ChromeInputClickById($objid, $index = 0, $timeout = 5) dim $response = "" ;~ $response = _ChromeEval("document.getElementsById('" & $objid & "')[" & $index & "].click();", $timeout) ;if multiple input present $response = _ChromeEval("document.getElementById('" & $objid & "').click();", $timeout) ; if only 1 input present SetError(@error) return StringRegExpReplace($response, '\{\".+\":\"(.+)\"\}$', '$1') EndFunc Edited May 8, 2020 by zeenmakr Link to comment Share on other sites More sharing options...
rlvitorino Posted June 9, 2020 Share Posted June 9, 2020 autoit-chrome-native-messaging-host_.au3 AU3 autoit-chrome-native-messaging-host_.au3 Link to comment Share on other sites More sharing options...
dedekoko Posted August 22, 2020 Share Posted August 22, 2020 On 4/2/2019 at 11:05 PM, yeisson said: Hi! Currently I have Windows 10, version 1809, I'm also running Chrome version 73.0.3683.86 and work correctly by only ensuring that after installing "autoit_chrome_native_messaging_host_install" and have the correct id of the Chrome extension to be used in the manifest file: 😄 \ Users \ <User> \ AppData \ Roaming \ AutoIt3 \ Chrome Native Messaging Host \ manifest.json "allowed_origins": [ "chrome-extension://leakmpklghcpopcfgkkjjfhmlkhocjlj/" ] To know your extension id you must enable the developer mode and it immediately appears, after that you update the manifest and everything will work fine. I hope it helps, greetings. its work after do the change my win 10 pro thx alot Link to comment Share on other sites More sharing options...
Iraj Posted August 24, 2020 Share Posted August 24, 2020 Its not working for https based websites. Can someone help? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 24, 2020 Developers Share Posted August 24, 2020 7 minutes ago, Iraj said: Its not working for https based websites. Can someone help? Care to share all information that would be required to help you with that? 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. 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