Jump to content
seangriffin

Chrome UDF

Recommended Posts

Zohaib

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

Share this post


Link to post
Share on other sites
junkew

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

  • Like 1

Share this post


Link to post
Share on other sites
Zohaib

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?

Share this post


Link to post
Share on other sites
arthalita01

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

Share this post


Link to post
Share on other sites
neonoff

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

Share this post


Link to post
Share on other sites
neonoff

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

Share this post


Link to post
Share on other sites
duzers

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

Share this post


Link to post
Share on other sites
sthornhill11

 

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!

Share this post


Link to post
Share on other sites
AdnanZahid

I can install AutoIt extension but cannot enable it because it is not available on Chrome Web Store. Any ideas?

Share this post


Link to post
Share on other sites
Berfs

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

Share this post


Link to post
Share on other sites
junkew

@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

Share this post


Link to post
Share on other sites
Oldeschool

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?

Share this post


Link to post
Share on other sites
obryana

Any ideas for how I can automatically disable the Save Password box that pops up every time someone logs in to a password protected website?

Share this post


Link to post
Share on other sites
directxguy

Hello. I too am wondering if there are any plans to submit this to the store so that it can be used with current versions of chrome.

Share this post


Link to post
Share on other sites
amartinez

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

Share this post


Link to post
Share on other sites
mazinasm

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

Share this post


Link to post
Share on other sites
wowxxoo

hi,polymath.

i have a question:i have opened one chrome browser,can i use the opening chrome  navigate another url by the chrome UDF? thank you very much!! 

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • kcvinu
      By kcvinu
      Hi all,
      I am playing with _GUICtrlButton_Create function. How can i change this button's (or the entire form's) font ?. The in-built GUICtrlSetFont function is not working even when i convert the control handle to control ID with _WinAPI_GetDlgCtrlID ( ) function.  Do i need to use CreateFont api finction and send WM_SETFONT message ? Or is there any other easy and safe ways to do this ?. Thanks in advance.
      Note : This window is created by CreateWindowEx function, not by GUICreate function. 
    • rudi
      By rudi
      Hello,
      usually I do Win automations, so I have no skills at all to handle HTML forms :-/
      The script to catch and syntax check  the required information from Excel is done.
      Now I'd like to automate the upload using this form, too:
       
      http://flashcardsdeluxe.com/flashcards/Upload.aspx
      What browser is easiest to do so? (IE, Chrome, FF) The Values $DeckCode, $DeckName, $DeckDefinition shall go to their HTML form fields finally "click" the button "upload flashcards" <table width="70%" class="cssCenter" border="0"> <tr> <td style="width: 1%">Deck&nbsp;Code</td> <td style="width: 100%"><input name="ctlDeckCode" type="text" id="ctlDeckCode" style="width:50%;" /> (no spaces allowed)</td> <td></td> </tr> <tr> <td style="width: 1%">Deck&nbsp;Name</td> <td style="width: 100%"><input name="ctlDeckName" type="text" id="ctlDeckName" style="width:50%;" /> (optional)</td> <td style="width: 1%" align="right"><input type="submit" name="ctlUpload" value="Upload Flashcards" id="ctlUpload" /></td> </tr> <tr> <td valign="top" style="padding-top: 5px" >Flashcard&nbsp;Text</td> <td colspan="2"><textarea name="ctlFlashcardText" rows="2" cols="20" id="ctlFlashcardText" style="height:280px;width:100%;"></textarea></td> </tr> </table> If someone kindly could jump in showing how to address just one of the input fields and how to "click" the "upload flashcards" button, I should be able to do the rest myself.
      TIA, Rudi.

    • TheWizEd
      By TheWizEd
      It seems AutoIt for Chrome is no longer working.  It's not in Google Store so not able to enable.  I can download the crx and drag to chrome but I can't figure out any way to enable the extension.
    • zxc3
      By zxc3
      Are there any examples of a script for Сhrome that allows you to check whether the information in the browser window has changed with a certain periodicity and signal this for 32-bit Windows.
    • okolaris
      By okolaris
      Hey everyone,
      I thought I might share my little Language UDF plus the more powerful SciTE Tool to ship Strings from SciTE into the xml file. While I haven't had the time to fully adapt the small UDF to one of the big XML-UDFs the so called "Language Transmitter" that basically writes the XML file for you runs mostly on "XML DOM wrapper (COM)" by eltorro. The Transmitter should work with other XML-Language-UDFs depending on their encoding.
       
      First let's start with the UDF, there are two functions of interest: _LangInit($sFilePath) and s($sString) As you will have guessed, _LangInit($sFilePath) is called once to initialize the UDF and s($sString) is used to receive the string to your key. Plain and simple.
      Now to the actual "new" part, the Language Transmitter. It basically allows you to transfer a selected String from SciTE into a xml file. While doing so it will scan for AutoIt variables, macros etc. and parse the string to fit StringFormat(). It then saves the formatted string in the xml file and returns the formatted call into SciTE. If the selected string is already defined it will directly parse the key into SciTE. To change the default output file, you can either edit the ini-file in the @ScriptDir of the LanguageTransmitter.exe or press Alt+A on empty space again and keep clicking cancel/no until the Transmitter let's you select the current output file. Standard output is strings.xml in the current opened AutoIt Script.
      Example:
      ; given the line: MsgBox(16, 'Error', 'Error message') ; select 'Error' run the Transmitter follow the instructions, repeat with 'Error message'. Outcome (e.g.): MsgBox(16, s('Error'), s('Error_msg')) ; Variables and Macro example: $sString = "Value: " & $iValue & @CRLF & 'Another value: '& $iValue2 ; Select the full string including all AutoIt variables and macros etc. in SciTE and press Alt+A (default) to run the LanguageTransmitter ; follow the instructions and it will then paste a formatted string like that into SciTE: $sVar = StringFormat(s('Key'), $iValue, $iValue2) ; the correlating xml entry should look like that: ; <string name="Key">Value: %s\r\nAnother value: %s</string> ; as you can see @CRLF has been replaced with \r\n as well. If you are working on a project and want to directly add a string to the xml file just start the Language Transmitter without selecting any text, enter your string and a key.
      SetUp/Installation
      Examples
      Since xml files are required all examples can be found in the zip file. There are two examples, one includes a language selection interface.
      Language File Checker
      I added a script to check whether the xml file contains all required strings or even unnecessary strings.
       
      Hope you like my little helper!
       
      UDF - LanguageSupport.zip
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.