Jump to content

Chrome UDF


seangriffin
 Share

Recommended Posts

  • 2 weeks later...

Hello Friends.
please guide me for how to navigate chrome by its autoit udfs.
 

_ChromeStartup() ... this function takes url and opne chrome with this url. i want to navigate the chrome frome this url to another url. how i can do it?

Thanks in Advance

Link to comment
Share on other sites

I assume you can do something like

Not tested but should lead to something like

_ChromeEval("window.location = "http://www.mozilla.org";");

alternate udf is to search for iuiautomation in example forum

Link to comment
Share on other sites

I assume you can do something like

Not tested but should lead to something like

_ChromeEval("window.location = "http://www.mozilla.org";");

alternate udf is to search for iuiautomation in example forum

 

I tried to use _ChromeEval("window.location = "http://www.mozilla.org";"); this but it dosn't work. i also find iuiautomation example but it was mouse movement. i want to automate chrome without using mouse like IE and FF.

Is there any other way to navigate chorome?

Link to comment
Share on other sites

  • 3 weeks later...

where  _ChromeObjSetValueById ?

 i try add

Func _ChromeObjSetValueById($objid, $value, $index = 0, $timeout = 5)

    dim $response = ""

    $response = _ChromeEval("document.getElementsById('" & $objid & "')[" & $index & "].value = '" & $value & "';", $timeout)

    SetError(@error)

    return $response
EndFunc

Html Target

<TITLE>Chrome Example Form</TITLE>

<input type='text' id='textExample' value='http://' size='20' maxlength='30'>
#Include <Array.au3>
#Include <Chrome.au3>

_ChromeShutdown()
_ChromeStartup("http://192.168.2.100/x/cromeauto1")
_ChromeDocWaitForExistenceByTitle("Chrome Example Form", 5)

_ChromeObjSetValueById("textExample", "12121218") ;<<<<<<<---- BUT not working

>_<


tanks..

Edited by arthalita01
Link to comment
Share on other sites

  • 3 weeks later...

Hello Friends.

please guide me for how to navigate chrome by its autoit udfs.

 

_ChromeStartup() ... this function takes url and opne chrome with this url. i want to navigate the chrome frome this url to another url. how i can do it?

Thanks in Advance

_ChromeEval("document.location.replace('YOUR URL');")

that worked for me

Edited by neonoff
Link to comment
Share on other sites

  • 2 weeks later...

Recently Google has  disabled all extensions not from the google extension store. That's why this UDF stopped work, cause autoit extension was disabled by chrome. There are several ways to hack this but the most appropriate for my goals was to downgrade chrome.

This politics was annonced by Google in the January 2014 so all versions of Chrome after January automatically disables non store extensions. I chose the latest stable version of Chrome before 2014, it is 31.0.1650.63. Then I modified my host file (C:WINDOWSsystem32driversetchosts) with usual Windows notepad and added this strings:

127.0.0.1 clients.google.com
127.0.0.1 clients1.google.com
127.0.0.1 clients2.google.com
127.0.0.1 clients3.google.com
127.0.0.1 clients4.google.com
127.0.0.1 clients5.google.com
127.0.0.1 clients6.google.com
127.0.0.1 clients7.google.com
127.0.0.1 clients8.google.com
127.0.0.1 clients9.google.com
127.0.0.1 lh1.googleusercontent.com
127.0.0.1 lh2.googleusercontent.com
127.0.0.1 lh3.googleusercontent.com
127.0.0.1 lh4.googleusercontent.com
127.0.0.1 lh5.googleusercontent.com
127.0.0.1 lh6.googleusercontent.com
127.0.0.1 lh7.googleusercontent.com
127.0.0.1 encrypted-tbn1.gstatic.com
127.0.0.1 encrypted-tbn2.gstatic.com
127.0.0.1 encrypted-tbn3.gstatic.com
127.0.0.1 encrypted-tbn4.gstatic.com
127.0.0.1 encrypted-tbn5.gstatic.com

 

this strings prevent Chrome from upgrading.

Pros

I have working version of Chrome where I can install any extension I want and this extansions are enabled each time I start up Chrome.

Cons

I have not the latest version of Chrome with possible drawbacks, but I have this version installed on my virtual machine so for me it's not a minus at all.

P.S. One can have up-to-date Chrome and working extension, but each time you start up Chrome you will see annoying message about non store extension with suggestion to disable it.

Edited by neonoff
Link to comment
Share on other sites

where  _ChromeObjSetValueById ?

 i try add

Func _ChromeObjSetValueById($objid, $value, $index = 0, $timeout = 5)

    dim $response = ""

    $response = _ChromeEval("document.getElementsById('" & $objid & "')[" & $index & "].value = '" & $value & "';", $timeout)

    SetError(@error)

    return $response
EndFunc

Html Target

<TITLE>Chrome Example Form</TITLE>

<input type='text' id='textExample' value='http://' size='20' maxlength='30'>
#Include <Array.au3>
#Include <Chrome.au3>

_ChromeShutdown()
_ChromeStartup("http://192.168.2.100/x/cromeauto1")
_ChromeDocWaitForExistenceByTitle("Chrome Example Form", 5)

_ChromeObjSetValueById("textExample", "12121218") ;<<<<<<<---- BUT not working

>_<

tanks..

 

Not getElementsById but getElementById, and maybe without $index.

Try this:

Func _ChromeObjSetValueById($objid, $value,  $timeout = 5)
    dim $response = ""
    $response = _ChromeEval("document.getElementById('" & $objid & "').value = '" & $value & "';", $timeout)
    SetError(@error)
    return $response
EndFunc
Link to comment
Share on other sites

  • 4 weeks later...

 

STEP 2: Install the AutoIT Chrome Native Messaging Host.

Open the following link and download the file named autoit_chrome_native_messaging_host_install.exe:

https://docs.google.com/file/d/0B_6JmwNIIZ06eDgxaVJPNUNxa28/edit?usp=sharing

Note - you may be prompted to login with a Google account as this file is hosted on Google Drive.

 

I cannot get this file to download.

It keeps giving me an error message -

"Sorry, this file is infected with a virus

Only the owner is allowed to download infected files."

 

Looking forward to trying this out!

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Hi,

Thanks for the script. I have the problem, that when i use your first example, autoit opens chrome and navigate to the page. But nothing happens, no entry is filled or clicked.

Edited by Berfs
Link to comment
Share on other sites

@Berfs: Probably better to open a new thread in general help and support if you have issues with the iuiautomation and chrome. Most likely you missed chrome://accessibility page

For others using chrome you can communicate thru a textbox and addressbar commands

Type this once for each page and an edit will be added

javascript: var e = document.createElement("input");e.setAttribute("value","Hello world");document.body.appendChild(e);void(0); 

then if you want to have data in it you type in addressbar

javascript: e.setAttribute("value", document.documentElement.innerHTML);

and this data you can retrieve with regular IUIAutomation scripts

I just did not have time to wrap that into UIAWrappers logic (as this concept works on all browsers that support bookmarklets)

Edited by junkew
Link to comment
Share on other sites

  • 4 weeks later...

Is there any plans of getting the Chrome UDF submitted to the Chrome Store?  I see that you are going a different way with IUI automation?    Can we still get support for the Chrome UDF such as downloading the files required?  Would you be willing to let someone else pursue the submitting extension to the Google store?

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

Extensions can be loaded in unpacked mode by following these steps:

  1. Visit chrome://extensions (via omnibox or menu -> Tools -> Extensions).
  2. Enable Developer mode by ticking the checkbox in the upper-right corner.
  3. Click on the "Load unpacked extension..." button.
  4. Select the directory containing your unpacked extension.

The crx file needs to be extracted first. CRX files are zip files with a different header. Any capable zip program should be able to open it. If you don't have such a program, I recommend 7-zip.

Edited by amartinez
Link to comment
Share on other sites

  • 4 weeks later...

Hi I have a problem with querySelector.

When i use my code, extension is down and doesn't work 

 image: http://screencast.com/t/AT1F45pF

Translation image

"There has been a breakdown AutoIT for Google Chrome. Click on this message to re-download this extension"

$class="input.mailbox__auth__button[type='submit']"
$oInputs = 'document.querySelector("'&$class&'").click()'
_ChromeEval("document.getElementsByName('Login')[0].value='petrsbu62'")
_ChromeEval("document.getElementsByName('Password')[0].value='z123456'")
_ChromeEval($oInputs)

I check full js in input.txt all is right 

document.querySelector("input.mailbox__auth__button[type='submit']").click()

I know that i can use some of the function from chrome.au3, but i need to now is querySelector are work in Chrome.ua3 or not. 

Edited by mazinasm
Link to comment
Share on other sites

  • 2 months later...

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
 Share

×
×
  • Create New...