Jump to content

Recommended Posts

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:

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.

 

And i have a easy  way to slove this problem:

1, open the chrome extension;

2, open development model;

3, drag  the plugin  into the extended chrome!

Ok! Fixed! Enjoy

For any version of chrome.

Link to post
Share on other sites
  • 3 weeks later...
  • Replies 167
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Chrome support for AutoIT is here!  This UDF includes a Chrome Extension (http://developer.chrome.com/extensions/getstarted.html) and Native Messaging Host (http://developer.chrome.com/extensions/m

Hmmm, odd that something is uploading.  There certainly isn't anything in this solution that uploads or downloads. Here's a description of exactly what the 3 components to the UDF do (in case anyone

Yes, it might seem odd that the registry value is escaped, though it must be this way or the native messaging host won't start.  That's my experience. Here's more information to help in troubleshoot

Posted Images

  • 1 month later...

Are you still supporting this.  This has been very useful but we ran into some conditions when using various constructions kits like JFace, JQuery, etc..  The html elements do not have "name" attributes but do have generated "id" attributes.  I added some additional routines to support this:

; #FUNCTION# ;===============================================================================
;
; Name...........: _ChromeLoadURL()
; Description ...: Load a URL web page based.
; Syntax.........: _ChromeLoadURL($url, $timeout = 5)
; Parameters ....: $url         - the URL to load
;     $timeout     - Optional: a number of minutes before exiting the function.
; Return values .:  On Success     - Returns "".
;                  On Failure     - Returns "", and sets @ERROR = 2.
; Author ........: seangriffin
; Modified.......:
; Remarks .......: A prerequisite is that the Chrome browser is open
;     (Window title = "[REGEXPTITLE:.*- Google Chrome]").
;
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _ChromeLoadURL($url, $timeout = 30)

 Dim $response = ""

 $response = Chrome_Eval("Chrome_LoadURL=" & $url, $timeout)

 SetError(@error)

 Return $response
EndFunc


; #FUNCTION# ;===============================================================================
;
; Name...........: _ChromeInputClickByID()
; Description ...: Clicks an <input> element based on it's "ID" attribute.
; Syntax.........: _ChromeInputClickByID($objid, $timeout = 5)
; Parameters ....: $objid       - the value of the "name" attribute
;     $timeout     - Optional: a number of minutes before exiting the function.
; Return values .:  On Success     - Returns "".
;                  On Failure     - Returns "", and sets @ERROR = 2.
; Author ........: seangriffin
; Modified.......:
; Remarks .......: A prerequisite is that the Chrome browser is open
;     (Window title = "[REGEXPTITLE:.*- Google Chrome]").
;
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _ChromeInputClickByID($objid, $timeout = 5)

 dim $response = ""

 $response = _ChromeEval("document.getElementByID('" & $objid & "').click();", $timeout)

 SetError(@error)

 return $response
EndFunc

; #FUNCTION# ;===============================================================================
;
; Name...........: _ChromeObjGetValueByID()
; Description ...: Gets the value of an element based on it's "id" attribute.
; Syntax.........: _ChromeObjGetValueByID($objid, $index = 0, $timeout = 5)
; Parameters ....: $objid       - the value of the "id" attribute
;     $timeout     - Optional: a number of minutes before exiting the function.
; Return values .:  On Success     - Returns $value.
;                  On Failure     - Returns "", and sets @ERROR = 2.
; Author ........: seangriffin
; Modified.......:
; Remarks .......: A prerequisite is that the Chrome browser is open
;     (Window title = "[REGEXPTITLE:.*- Google Chrome]").
;
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _ChromeObjGetValueByID($objID, $timeout = 5)

 dim $response = ""

 $response = _ChromeEval("document.getElementByID('" & $objid & "').value;", $timeout)

 SetError(@error)

 return $response
EndFunc

; #FUNCTION# ;===============================================================================
;
; Name...........: _ChromeObjSetValueByID()
; Description ...: Sets the "value" attribute of a element based on it's "id" attribute.
; Syntax.........: _ChromeObjSetValueByID($objid, $value, $timeout = 5)
; Parameters ....: $objid       - the value of the "id" attribute
;     $value      - The text to set the "value" attribute to
;     $timeout     - Optional: a number of minutes before exiting the function.
; Return values .:  On Success     - Returns $value.
;                  On Failure     - Returns "", and sets @ERROR = 2.
; Author ........: seangriffin
; Modified.......:
; Remarks .......: A prerequisite is that the Chrome browser is open
;     (Window title = "[REGEXPTITLE:.*- Google Chrome]").
;
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _ChromeObjSetValueByID($objid, $value, $timeout = 5)

 dim $response = ""

 $response = _ChromeEval("document.getElementByID('" & $objid & "').value = '" & $value & "';", $timeout)

 SetError(@error)

 return $response
EndFunc

 

Would you be able to add these to your base?  We also added _ChromeLoadURL to change the current URL  I added the following to contentscript.js:

 if (request.greeting.indexOf("Chrome_LoadURL=") == 0)
 {
  var arg = request.greeting.substr("Chrome_LoadURL=".length);

  window.location.assign(arg);
 }

chrome_additional.au3

contentscript.js

Link to post
Share on other sites
  • 2 weeks later...

 

And i have a easy  way to slove this problem:

1, open the chrome extension;

2, open development model;

3, drag  the plugin  into the extended chrome!

Ok! Fixed! Enjoy

For any version of chrome.

I can not activate the extension , I can not follow the steps you indicate . How I can do step 2 ??

Link to post
Share on other sites
  • 1 month later...

Wow,

This is exactly what I'm looking for, but like "conmed", I cannot get the extension enabled using the workaround. 

Can you elaborate wowxoxo? or maybe this no longer works in the latest versions of Chrome.

I don't suppose it's feasible to actually get the extension published on the Chrome Web Store? I guess Google might not allow it anyway since the tool could be used maliciously.  

Link to post
Share on other sites

I am also stuck and unable to use the extension at all.

I followed install instructions including using admin install for autoit_chrome_native_messaging_host_install.exe

I checked "Developer Mode" in Chrome when installing AutoIT for Google Chrome.crx (actually I installed it in both developer and non-developer).

I am not observing that the correct registry entries have been made during the install process.  Should I manually create these keys?  The first example script will load the form but not fill it out, and eventually times out.

Every time I check the Chrome Extensions, the "Enable" box for AutoIT for Google Chrome has been unchecked, even in developer mode, and "Not from Chrome web store" sites underneath the unchecked box.

Downgrading chrome is not an option for me as my autoit application serves an environment in which other software requires specific modern versions of Chrome.

Any hope or is Chrome automation dying off from Autoit?  Would obviously be very supportive of attempts to get the tool added to the Chrome store if that is the obstacle.

Cheers

 

Autoit v3.3.12.0

Win 7 64 bit

Chrome 44.0.2403.89 m

Edited by wliebkem
Link to post
Share on other sites
  • 1 month later...

Chrome support for AutoIT is here!  :D

This UDF includes a Chrome Extension (http://developer.chrome.com/extensions/getstarted.html) and Native Messaging Host (http://developer.chrome.com/extensions/messaging.html#native-messaging-host) that integrate with a new Chrome UDF (Chrome.au3) to provide automation support for the Chrome browser.

Several steps are required to install the Chrome Extension and Native Messaging Host prior to using the UDF.  Please read the INSTALLATION section below.

REQUIREMENTS:

  • Windows XP 32-bit, Windows 7 32-bit or Windows 7 64-bit
  • AutoIt3 3.2 or higher
  • Chrome v29 or later (earlier versions are untested)
  • AutoIT for Google Chrome (Chrome extension - see below)
  • AutoIT Chrome Native Messaging Host (see below)

INSTALLATION:

STEP 1: Install the AutoIT extension into Chrome.

Open the following link and download the file named AutoIT for Google Chrome.crx:

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

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

In your Chrome browser click on the Chrome menu, then select Tools -> Extensions.  Drag the AutoIT for Google Chrome.crx file that you downloaded above, from Windows Explorer, into this page in Chrome.  You should now see AutoIT for Google Chrome listed in the Extensions page in Chrome.  Ensure that the Enabled checkbox next to AutoIT for Google Chrome is checkedAlso make sure the Allow access to file URLs box is checked (very important to make EXAMPLE 2 work below)!!

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.

Run this file (autoit_chrome_native_messaging_host_install.exe).  An installation window will display.  Click the Install button.  The window will display "Completed" and you can click the Close button.

STEP 3: Install the Chrome UDF into AutoIT.

Scroll to the DOWNLOAD section below, and save the Chrome.au3 file into your AutoIT Include folder (C:Program FilesAutoIt3Include).

Please close your Chrome browser once you've completed these steps.

LIST OF FUNCTIONS:

 

EXAMPLE #1:

This following example starts up Chrome and navigates to the URL http://www.december.com/html/demo/form.html.  It then automatically completes the HTML form in this page (a series of text, radio, and checkbox input elements and select elements) and clicks the Send this survey button.  The script waits for the next page to load, and retrieves the various elements from the page to the AutoIT console.

chrome_example.au3

EXAMPLE #2:

The following is an example of the automation of an offline HTML page (file URL).  First, download the file named chrome_udf_example_2.html to your C: folder:

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

Then run the following AutoIT script:

chrome_example_2.au3

Note that you must have checked the Allow access to file URLs box in the Chrome extension to make this work!

DOWNLOAD:

Latest Version - v0.5 (29/09/13)

Chrome.au3

Hi Seangriffin,

I have done all these steps but when I test my script, chrome disables the Extension for AutoIt because it is not from Chrome web store. If says that uploading extension to chrome web store will resolve the issue.

Is there any other solution to it?

Thanks,

PD

Link to post
Share on other sites

This is also not working. I have same code in UDF. but when I run chrome, it opens up the page but in editor gives below error.

C:\Program Files (x86)\AutoIt3\Include\Chrome.au3 (829) : ==> Variable used without being declared.:
$response = _ChromeEval("document.getElementByID('" & $objname & "').value = '" & $value & "';", $timeout)
$response = _ChromeEval("document.getElementByID('" & ^ ERROR

Thanks,

-PD

 

 

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 post
Share on other sites
  • 2 months later...

Hi Seangriffin,

I have done all these steps but when I test my script, chrome disables the Extension for AutoIt because it is not from Chrome web store. If says that uploading extension to chrome web store will resolve the issue.

Is there any other solution to it?

Thanks,

PD

http://superuser.com/questions/767286/re-enable-extensions-not-coming-from-chrome-web-store-on-chrome-v35-with-enhan

  1. Download the crx file and unpack the extension using your favorite decompresser. Take note of the directory where you placed it.
  2. Open the extension page, activate "Developer Mode"
  3. Click "Load unpacked extension..."
  4. Search trough your directory tree for the directory where you unpacked your extension and click OK. If your extension is called "my extension" then select "my extension" directory.

Advantages: You don't have to install anything else. Disadvantages: Chrome nags you to disable the extension each start up.

 

I've tried this with Chrome 48, it keeps the extension enabled, but pops up a dialog if you want to disable it or cancel.

 

The other option is to whitelist the extension with the Windows policy editor: https://productforums.google.com/forum/#!msg/chrome/9NlMAr6uEVc/ambkrcKpi1cJ

This doesn't bother you with a popup every time you start Chrome.

Edited by JoeF
Link to post
Share on other sites
  • 2 months later...

Hey, sorry, I hope this script is still being supported. I've followed the above directions, installed the autoit extension in developer mode, and allowed it access to file URL's, however running the first example script still doesn't work. Have things changed? I'm honestly not sure where to go from here.

Link to post
Share on other sites
  • 3 months later...
On 11/2/2016 at 6:04 AM, JaysCogs said:

Hey, sorry, I hope this script is still being supported. I've followed the above directions, installed the autoit extension in developer mode, and allowed it access to file URL's, however running the first example script still doesn't work. Have things changed? I'm honestly not sure where to go from here.

 

it's very very long time ago :( i want some code the same

Link to post
Share on other sites

I like many of you started out with ffload.au3 which would pixelsearch for a green pixel at the end of the loading bar in firefox 3. I got tired of running an outdated browser and moved over to chrome, it seems better these days anyway. Here is my setup..

 

Download Pace4Chrome extention, once in set it to color 2299DD and the loading to Centeratom, now we have a fairly reliable load indicator.

Here is your modified ffload function module below, feel free to critique my poor habits in a friendly manner.

Func _FfLoadWaitTime ($x, $y)
    Global $pop = 0
    While 1
       $pop = $pop + 1
        Sleep ( 0 )
    $loading = PixelGetColor ( $x, $y )
if $loading = 0x2299DD Then
       ;MsgBox(0, "loading detected", "blue loading started")
        ExitLoop
        ;Set the pop numbe below to what you want it to wait at untill it figures the load indicato didn't load, 900 is about 9seconds, i dunno why.
     elseif $pop = 900 Then
         ;MsgBox(0, "loading not detected", "first pop")
      ExitLoop
    EndIf
 WEnd

 While 1
       $pop = $pop + 1
        Sleep ( 0 )
    $loading = PixelGetColor ( $x, $y )
;if $loading <> 0x2299DD Then
   if Not ($loading == 0x2299DD) Then
      ;MsgBox(0, "loading detected", "blue loading ended")
      ExitLoop
  ;the pop below isn't even needed but i'm just posting this as it with debug msgbox's and all
  elseif $pop = 1400 Then
      ;MsgBox(0, "loading not detected", "second pop")

      ExitLoop
   EndIf
Wend

 EndFunc;==>_FfLoadWaitTime

Your cords to use when calling the function should be obvious but vary depending on you display res. Sometime the load indicator doesn't display, like 1 outs 25, so other is a pop to bypass if pixelseach doesn't find it's thing in x amount of time, default is 900 which is about 9 seconds on my machine, not sue why, would assume 9000 would be 9 seconds.

 

Anyway I think that's it, Hope some of you can use this.

Link to post
Share on other sites
  • 5 weeks later...
  • 3 months later...

I know this is probably an old thread but I wanted to point out to anyone that treks here that THIS UDF STILL WORKS AS OF CHROME 53.

For anyone wants to know how to get back on track or up and running, it's fairly simple but rather complex as well...I'm writing a guide because there some people who come here looking to find a way to automate Chrome for their workplace (like me) but can't get going because there aren't much answers as to if this might work or not. This UDF can work WITHOUT admin rights, it theoretically can if you tune the registry to CURRENT_USER.

There's THREE IMPORTANT components that come into play in order to make it work really well:

1. The Native Messaging Host (The Author called it  autoit_chrome_native_messaging_host). I simply call it the NMH.

2. The AutoIT Chome Extension

3. The Registry

FOR PEOPLE THAT NEED TO GET THIS UP ASAP:

1. INSTALL  autoit_chrome_native_messaging_host_install.exe

2. Install the chrome extension, the MESSAGING HOST should activate (please refer to the bottom as this extension is not fully working), you can tell in the little tray icon. THIS MEANS you are good to go and the host is awaiting instructions from the AUTOIT Script.

If it doesn't activate, something is wrong! It could be the registry, it could be way you set up your system, who knows. YOU will need to read further in order to figure where something went wrong.

3. To test, do: 

_ChromeEval("alert('hello world');")

 

FOR PEOPLE NOT GETTING THE CHROME EXTENSION TO WORK PROPERLY:

Chrome has stopped supporting third party or custom extensions for awhile now. This leads to the problem of having the extension not being able to work when you check mark ALLOW ACCESS TO FILE URLS. It can work without that but seangriffin seems to imply it would work much better if it had the ability to.  JoeF proposed the correct idea of extracting the CRX file (you can use anything: winZip, WinRar, 7zip), and placing the files in a folder. From there, get Chrome to go into developer mode ,and load that folder that you extracted into. This WILL break the NMH i guarantee you that! That's okay! WE CAN FIX IT EASILY. Go to the file of where the NHM is, which is AppData/Roaming/AutoIt/Chrome Native Messaging Host/. From there, you'll see there are two files. the autoit-chrome-native-messaging-host.exe and manifest.json. Open that manifest.json with notepad or whatever edit too. Now go back into your chrome and look at the ID of the unpacked extension that you loaded, it should give you an ID. YOU NEED TO TAKE THAT ID and replace it in the manifest json. It looks somewhat like this:

chrome-extension://nmocofiopaekephdbaeokkcnplpnenkg/

replace that green looking string with your ID given from Chrome. This is for security and everyone gets a different ID. If you want consistency, you will have to read further down because there is a way to make sure the same ID can always be used (This is useful portability or deployment). Now reload and the NHM should activate by itself and you'll see it as the little tray icon.

I'm gonna have to stop right here for now due to a time strain. It's a little late over here, so once i have time, i will update this guide some more for sure.

Spoiler

 

FOR PEOPLE THAT WANT TO KNOW IT WORKS (THIS WILL HELP RESOLVE ANY RUNNING ISSUES):

The Messaging Host installer installs the files into your AppData/Roaming/AutoIt/Chrome Native Messaging Host/ directory. The NMH nstaller also leaves a registry key in which the Autoit Chrome Extension can read its location and active the NHM from that particular directory.

So this is how it communicates:

First you load Chrome. Chrome will run that extension...

 

 

 

Edited by 7121
Link to post
Share on other sites
  • 1 month later...
On 9/29/2013 at 10:23 AM, seangriffin said:

V0.5 of the UDF is now released.

Python has now been replaced with AutoIT as the Native Messaging Host.  This brings significant performance improvements over the previous Python solution, and also allows easier maintenance in the future with a complete AutoIT solution.

If you already have a previous version of the UDF installated, then you must repeat Steps 1, 2 and 3 from the INSTALLATION section of the top post.

Python has now been replaced with AutoIT as the Native Messaging Host.

If this is the case can you please post the source Au3 for the native message host?

Thanks in advance!

 

Link to post
Share on other sites
  • 2 weeks later...

Is Udf Still Wroking

I tried extracting file and loading as packet

but still m not getting it working

please help me on this

chrome startup is working correctly but no other functions are working

some one please correct me if m doing something wrong or missing something important

Edited by n3wbie
Link to post
Share on other sites
  • 1 month later...

Quick HOW TO install AutoIT for Google Chrome.crx Chrome extension.

1, Download from here: https://docs.google.com/file/d/0B_6JmwNIIZ06enotRTVFNVdKOXM/edit?usp=sharing
2, Rename the file extension  from crx to zip (result will be: AutoIT for Google Chrome.zip)
3, Unzip the file in a folder
4, Open Chrome and navigate to the Extensions (chrome://extensions/)
5, Tick the "Developer mode"
6, Click to the "Load unpacked extension..." button and navigate to your previously unzipped folder

That's it!

Tested, working in Chrome Version 55.0.2883.87 m (64-bit)

Link to post
Share on other sites
  • 4 weeks later...
On 1/23/2017 at 1:58 AM, zuliasro said:

Quick HOW TO install AutoIT for Google Chrome.crx Chrome extension.

1, Download from here: https://docs.google.com/file/d/0B_6JmwNIIZ06enotRTVFNVdKOXM/edit?usp=sharing
2, Rename the file extension  from crx to zip (result will be: AutoIT for Google Chrome.zip)
3, Unzip the file in a folder
4, Open Chrome and navigate to the Extensions (chrome://extensions/)
5, Tick the "Developer mode"
6, Click to the "Load unpacked extension..." button and navigate to your previously unzipped folder

That's it!

Tested, working in Chrome Version 55.0.2883.87 m (64-bit)

Step 3 not working.

I rename crx into zip, but 7zip, winzip, report corrupted file

Do you have another location to download it? The file on google sizes only 23k

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By SkysLastChance
      How should I be attempting to click this link?

      <span id="x2m8_R-s" class="s_22 s-text">Walk&nbsp;In</span> If I double click the Walk$nbsp;In the text reads Walk In.

      How can I search for this text? 
      I have tried a several  different ways with no luck. Here are a few;
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//span[text()="Walk${nbsp}In"]') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[translate(text(), '\u00a0', ' ') = 'Walk In']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Walk In')]") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Walk&nbsp;In')]") Any help is appreciated as always. 
       
       
       
    • By mLipok
      wd_capabilities.au3 UDF was changed/modified/refactored .... and commited/merged (02-12-2021) to https://github.com/Danp2/WebDriver

      WARNING: Before you start using this UDF be sure you download the recent version from: https://github.com/Danp2/WebDriver
       
      ==================================================================================================

      Recently I start wd_capabilities.au3 project on my side.
      I think this is time to share to AutoIt community.
      Check attached UDF: wd_capabilities.au3

      Here is a scratch example showing how to use them:
      #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() ........ ........ ........ _WD_Capabilities_Build_Arguments(Null) ; CLEANUP ARGS _WD_Capabilities_Build_Arguments('--headless') _WD_Capabilities_Build_Arguments('start-maximized') _WD_Capabilities_Build_Arguments('disable-infobars') _WD_Capabilities_Build_Arguments('user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default') Local $s_WD_Capabilities_Arguments = _WD_Capabilities_Build_Arguments(Default) ; GET ARGS _WD_Capabilities_Build_Preferences(Null) ; CLEANUP PREFS If $s_Download_dir Then _WD_Capabilities_Build_Preferences('download.default_directory', $s_Download_dir) Local $s_WD_Capabilities_Preferences = _WD_Capabilities_Build_Preferences(Default) ; GET PREFS Local $s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome', $s_WD_Capabilities_Arguments, $s_WD_Capabilities_Preferences) Local $WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) ........ ........ ........ EndFunc  
      I plan to publish the code on GitHub.
      In the indefinite future, when the project becomes more functional, if @Danp2 accepts it, I hope it may be included in the main WebDriver UDF.

      I am waiting for yours feedback and help in the further development of this project.

      REMARK 1:
      As so far this UDF only supports GoogleChrome.
      Adding support for other browsers shouldn't be difficult, I just didn't need to.

      REMARK 2:
      For now, this project is working but still as a early BETA, so please do not discuss, ask questions, or post examples or snippets of code that pertain to any function of this UDF in other part of this forum, until it is found acceptable. Simply: discusion and tests only here in this topic.


      Regards,
      @mLipok
       
    • By Hermes
      Hi, I am struggling in setting the value of a textarea based on the value of clipboard (that contains a long web page source codes). If I use _WD_SetElementValue, it freezes after some time, or appears to be pressing tab and goes out of focus. I can also use send keys but i need the script to run in the background.
      Here is the full script:
      #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "WinHttp.au3" #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <AutoItConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <Excel.au3> Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "http://demo.borland.com/testsite/stadyn_largepagewithimages.html") _WD_LoadWait($sSession) Global $sSource = _WD_GetSource($sSession) Local $Paste = ClipPut($sSource) Local $sData = ClipGet() Local $aArray = 0, _ $iOffset = 1 While 1 $aArray = StringRegExp($sData, '(?s)<p>.*</p>', $STR_REGEXPARRAYMATCH, $iOffset) If @error Then ExitLoop $iOffset = @extended For $i = 0 To UBound($aArray) - 1 Local $Paste = ClipPut($aArray[$i]) Local $sRegExData = ClipGet() ;MsgBox(0, "", "$sRegExData = " & $sRegExData) Next WEnd _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_placeholder") _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") Local $sElement1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") _WD_FrameEnter($sSession, $sElement1) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") $textarea = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") _WD_ElementAction($sSession, $textarea, 'click') ;WD SetElementValue(SsSession, Stextarea, $sRegExData) <-- I can do this but the focus goes out, or the browser freezes _WD_FrameLeave($sSession) sleep(2000) Send("^v") _WD_LoadWait($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome Can someone help me please, or re-direct me to the right path? TIA!
    • By Hermes
      Hi, I am trying to select elements in print page (dialog window) for a specific web page. But when trying to do so, it looks like it does not allow me to do it.
      So far, this is what I have:
      _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $mainpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $mainpagebody, 2) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") Local $printbutton = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") _WD_ElementAction($sSession, $printbutton, 'click') _WD_LoadWait($sSession) Sleep(3000) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $printpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $printpagebody, 2) The script above highlights the main web page "body" element, then clicks a tag to print a specific part of the page, then it will open a print page window where i am trying to highlight the body of that print page - but it looks like it is dropping from the session because it opens up another chrome page chrome://print.
       
      Below is the output log:
      __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element/eb9e4673-4dec-4d4c-be6a-b7967743394b/click; $sData={"id":"eb9e4673-4dec-4d4c-be6a-b7967743394b"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... __WD_Post ==> Webdriver Exception: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C63733+2504499]\n\tOrdinal0 [0x00BFC401+2081793]\n\tOrdinal0 [0x00B024F0+1058032]\n\tOrdinal0 [0x00B55685+1398405]\n\tOrdinal0 [0x00B45E83+1334915]\n\tOrdinal0 [0x00B54CDB+1395931]\n\tOrdinal0 [0x00B45D4B+1334603]\n\tOrdinal0 [0x00B222B4+1188532]\n\tOrdinal0 [0x00B23149+1192265]\n\tGetHandleVerifier [0x00DDFB8C+1512252]\n\tGetHandleVerifier [0x00E8B0DF+2214031]\n\tGetHandleVerifier [0x00CE4BC3+484211]\n\tGetHandleVerifier [0x00CE3E69+480793]\n\tOrdinal0 [0x00C0218D+2105741]\n\tOrdinal0 [0x00C066E8+2123496]\n\tOrdinal0 [0x00C06827+2123815]\n\tOrdinal0 [0x00C0FB73+2161523]\n\tBaseThreadInitThunk [0x75EB62C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B34+1028]\n"}} _WD_ExecuteScript: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... _WD_ExecuteScript ==> Webdriver Exception: HTTP status = 500 _WD_LoadWait ==> Webdriver Exception __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}...  
      Is it even possible to select elements in print page?

    • By walec
      Hello
      How can I export a sheet to pdf using the OOoCalc.au3 UDF?
      Thank you for any hints or possibly other solutions / functions.
×
×
  • Create New...