Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

@Danp2

Hello,

Is it possible to start Chrome WebDriver with an extension? I tried to add "addExtensions" to $sDesiredCapabilities  but unfortunately, I don't know how. Can you help me with it?

Thank you.

Share this post


Link to post
Share on other sites

@Danp2

Little update about this issue.

I tried to run it with these desired capabilities.

'{"capabilities":{"alwaysMatch":{"chromeOptions":{"addExtensions":"C:\Users\KarlMueller\Desktop\Project CHROME\sso.crx","w3c":true,"enablePassThrough":false}}}}'

But I get this error.

WDStartup: OS:  WIN_10 WIN32_NT 17763 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.1.0.21
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: --log-path="C:\Users\KarlMueller\Desktop\Project CHROME\chrome.log"
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities":{"alwaysMatch":{"chromeOptions":{"addExtensions":"C:\Users\KarlMueller\Desktop\Project CHROME\sso.crx","w3c":true,"enablePassThrough":false}}}}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC6E5+509669]\n\tOrdinal0 [0x00F676FC+161532]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
_WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC6E5+509669]\n\tOrdinal0 [0x00F676FC+161532]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
_WD_CreateSession ==> Webdriver Exception: invalid argument: missing command parameters
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"https://telekom.de/"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC58E+509326]\n\tOrdinal0 [0x00F50FB9+69561]\n\tOrdinal0 [0x00F68DD7+167383]\n\tOrdinal0 [0x00F677F2+161778]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
_WD_Navigate: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC58E+509326]\n\tOrdinal0 [0x00F50FB9+69561]\n\tOrdinal0 [0x00F68DD7+167383]\n\tOrdinal0 [0x00F677F2+161778]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
+>12:03:54 AutoIt3.exe ended.rc:0

 

Share this post


Link to post
Share on other sites
1 hour ago, rkskaras said:

Is it possible to start Chrome WebDriver with an extension? I tried to add "addExtensions" to $sDesiredCapabilities  but unfortunately, I don't know how. Can you help me with it?

This isn't something I've done, so YMMV with this feedback. I don't believe that "addExtensions" is applicable here since were manually building the DesiredCapacities string. Therefore, I suggest that you try something like this --

'{"capabilities":{"alwaysMatch":{"chromeOptions":{"Extensions":{"C:\Users\KarlMueller\Desktop\Project CHROME\sso.crx"},"w3c":true,"enablePassThrough":false}}}}'

 

Share this post


Link to post
Share on other sites
3 minutes ago, Danp2 said:

This isn't something I've done, so YMMV with this feedback. I don't believe that "addExtensions" is applicable here since were manually building the DesiredCapacities string. Therefore, I suggest that you try something like this --

'{"capabilities":{"alwaysMatch":{"chromeOptions":{"Extensions":{"C:\Users\KarlMueller\Desktop\Project CHROME\sso.crx"},"w3c":true,"enablePassThrough":false}}}}'

 

Thank you for reply.

But it is not working :/ 

 

I still get this error.

_WDStartup: OS: WIN_10 WIN32_NT 17763 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.1.0.21
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: 
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities":{"alwaysMatch":{"chromeOptions":{"Extensions":{"C:\Users\KarlMueller\Desktop\Project CHROME\sso.crx"},"w3c":true,"enablePassThrough":false}}}}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC6E5+509669]\n\tOrdinal0 [0x00F676FC+161532]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
_WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC6E5+509669]\n\tOrdinal0 [0x00F676FC+161532]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
_WD_CreateSession ==> Webdriver Exception: invalid argument: missing command parameters
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"https://bi-portal.telekom.de/cognos/bi/"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC58E+509326]\n\tOrdinal0 [0x00F50FB9+69561]\n\tOrdinal0 [0x00F68DD7+167383]\n\tOrdinal0 [0x00F677F2+161778]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
_WD_Navigate: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x010BA903+1550595]\n\tOrdinal0 [0x0103A701+1025793]\n\tOrdinal0 [0x00FBC58E+509326]\n\tOrdinal0 [0x00F50FB9+69561]\n\tOrdinal0 [0x00F68DD7+167383]\n\tOrdinal0 [0x00F677F2+161778]\n\tOrdinal0 [0x00F673CA+160714]\n\tOrdinal0 [0x00F4221E+8734]\n\tOrdinal0 [0x00F42606+9734]\n\tOrdinal0 [0x00F42C80+11392]\n\tOrdinal0 [0x010542C7+1131207]\n\tGetHandleVerifier [0x011570FD+523789]\n\tGetHandleVerifier [0x01156E90+523168]\n\tGetHandleVerifier [0x0115E1E7+552695]\n\tGetHandleVerifier [0x011578FA+525834]\n\tOrdinal0 [0x0104B7FC+1095676]\n\tOrdinal0 [0x00F42053+8275]\n\tOrdinal0 [0x00F41DA7+7591]\n\tGetHandleVerifier [0x014BA3BC+4075724]\n\tBaseThreadInitThunk [0x772A0419+25]\n\tRtlGetAppContainerNamedObjectPath [0x778C662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x778C65FD+189]\n"}}
+>13:51:51 AutoIt3.exe ended.rc:0

Can it be because of I am using WebDriver version 78.0.3904.70 on Google Chrome version 78.0.3904.87  ?

Share this post


Link to post
Share on other sites
6 minutes ago, Danp2 said:

@rkskaras The format of DesiredCapabilities is obviously incorrect. I gave a shot at assisting you to fix it, but obviously I was wrong.

Let us know if you come up with a working example. :thumbsup:

:D 

I don't know.

I tried 

{"capabilities":{"alwaysMatch":{"chromeOptions":{"Extensions":"sso.crx","w3c":true,"enablePassThrough":false}}}}

and

'{"capabilities":{"alwaysMatch":{"chromeOptions":{"Extensions":"C:\\Users\\KarlMueller\\Desktop\\Project CHROME\\sso.crx","w3c":true,"enablePassThrough":false}}}}'

and also

'{"capabilities":{"alwaysMatch":{"chromeOptions":{"Extensions":"C://Users//KarlMueller//Desktop//Project CHROME//sso.crx","w3c":true,"enablePassThrough":false}}}}'

I know that the Format is now okay. But it still does not work 

Share this post


Link to post
Share on other sites

I would suggest to use "goog:chromeOptions" instead of "chromeOptions" and add "excludeSwitches": ["enable-automation"] in the options.

Since I don't have a crx flle, I tested loading extension folder and it worked OK, even though a balloon popped up warning not to use an extension when Chrome is in developer mode. My test capabilities are as below:

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _
'"args": ["start-maximized", "load-extension=C:\\users\\cycho\\appdata\\local\\google\\chrome\\user data\\default\\extensions\\pkedcjkdefgpdelpbcmbmeomcjbeemfm\\7819.902.0.1_0"] }}}}'

The extension folder is the folder where manifest.json file for the extension is located.

Share this post


Link to post
Share on other sites
1 hour ago, CYCho said:

I would suggest to use "goog:chromeOptions" instead of "chromeOptions" and add "excludeSwitches": ["enable-automation"] in the options.

Since I don't have a crx flle, I tested loading extension folder and it worked OK, even though a balloon popped up warning not to use an extension when Chrome is in developer mode. My test capabilities are as below:

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _
'"args": ["start-maximized", "load-extension=C:\\users\\cycho\\appdata\\local\\google\\chrome\\user data\\default\\extensions\\pkedcjkdefgpdelpbcmbmeomcjbeemfm\\7819.902.0.1_0"] }}}}'

The extension folder is the folder where manifest.json file for the extension is located.

Wow, Thank you very much! This worked like a charm :) 

 

Share this post


Link to post
Share on other sites

@Danp2 Can I narrow down the search by doing something like this? 

$wSaveBI = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//li[@id='toolactions_SAVE-tbb'@changed_by_user='False']")

This does not work by the way.  

Basically I am clicking on an element to save my progress but I am wanting to double-check if it was actually saved or not. And the only way to do, I have found (I looked into many possible ways of testing if it was clicked or not), is to narrow the FindElement. 

If the element is clicked or not it has the same id (and everything else is the same. Class and all), but the @changed_by_user is different. (not clicked = false clicked = true)

Is there a way to do something like this?

Share this post


Link to post
Share on other sites

@Danp2 

15 hours ago, Danp2 said:

@nooneclose This is really an xpath locator question, but I believe something like this should work --

"//li[@id='toolactions_SAVE-tbb' and @changed_by_user='False']"

 

It didn't work. 

I found some documentation on Xpath locator. :)  

If I get it to work I will post the code :D 

Edited by nooneclose
Found sources had to change my questions

Share this post


Link to post
Share on other sites

Here is the working code for my issue. (Issue was how do I code my script to test if data was properly sent. The button that saves doesn't change and the only difference on the page at all is that buttons element class changes from on to off) Thanks, @Danp2 for telling and showing me Xpath.

Here are the elements I had to work with: (first one is when the save button is unclicked. The second is when its clicked)

<a role="button" id="toolactions_SAVE-tbb_anchor" onkeydown="itemAKey(event,this)" title="Save Work Order CTRL+ALT+S" hotkey="S" eventtype="SAVE" class="on" <img role="button" tabindex="-1" id="toolactions_SAVE-tbb_image" src="nav_icon_save.gif" alt="Save Work Order CTRL+ALT+S" draggable="false"></a>
 

<a role="button" id="toolactions_SAVE-tbb_anchor" onkeydown="itemAKey(event,this)" title="Save Work Order CTRL+ALT+S" hotkey="S" eventtype="SAVE" class="off opacity_20"><img role="button" tabindex="-1" id="toolactions_SAVE-tbb_image" src="nav_icon_save.gif" alt="Save Work Order CTRL+ALT+S" draggable="false"></a>
 

Here is the working code that I used in a do until loop. :D 

Local $wSaveBI = ""
Local $wSavedI = ""

; Loop until the data is saved
Do
    $wSaveBI = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@id='toolactions_SAVE-tbb_anchor' and @class='on']")

    _WD_ElementAction($sSession, $wSaveBI, 'click')
    Sleep(2000)

    $wSavedI = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@id='toolactions_SAVE-tbb_anchor' and contains(@class,'off')]")

    ;ConsoleWrite("Test: " & $wSavedI & @CRLF)

Until $wSavedI <> ""

 

Edited by nooneclose
grammar

Share this post


Link to post
Share on other sites
1 hour ago, Danp2 said:

@nooneclose You could look into using _WD_WaitElement, which handles the looping for you. :thumbsup:

@Danp2 What are you talking about Willis? You telling me I could have avoided a lot of looping? I'm sad and happy all at the same time. 

I will try this thank you.

Edited by nooneclose
Found the documentation

Share this post


Link to post
Share on other sites

Here are the command I use

WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='files[]' and @id='inputFile']", 0, 500, True)
$Upload = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='files[]' and @id='inputFile']")
,_WD_ElementAction($sSession, $Upload, 'click')

and here is the debugging part 

__WD_Post: URL=HTTP://127.0.0.1:17556/session/BAC28C55-EE1C-4967-B64D-D7879AB55E49/element; $sData={"using":"xpath","value":"//input[@name='files[]' and @id='inputFile']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"efefb6e7-95fa-433f-8e9f-bedfeec2d220","element-6066-11e4-a52e-4f735466cecf":"efefb6e7-95fa-433f-8e9f-bedfeec2d220"}}
_WD_FindElement: {"value":{"ELEMENT":"efefb6e7-95fa-433f-8e9f-bedfeec2d220","element-6066-11e4-a52e-4f735466cecf":"efefb6e7-95fa-433f-8e9f-bedfeec2d220"}}
__WD_Get: URL=HTTP://127.0.0.1:17556/session/BAC28C55-EE1C-4967-B64D-D7879AB55E49/element/efefb6e7-95fa-433f-8e9f-bedfeec2d220/displayed
__WD_Get: StatusCode=500; $iResult = 0; $sResponseText=Unknown error...
_WD_ElementAction: Unknown error...

and nothing happen with element action

It seems that the input file only accept drag and drop or clicking on the left or right button to open file dialog 
 


 

Share this post


Link to post
Share on other sites

this is 

_
WD_ElementAction($sSession, $Upload, 'click')

That is not accepted. Only a click on left or right button of the mouse is accepted. Is it possible with elementAction to do something ?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jgladden
      Dan - thanks for all that you do - this stuff is great. 
      Hoping you can assist with an issue we are having now that we have moved to Windows 10/Server 2016. The Chrome interactions were working flawlessly until moving over. Now my code fails when attempting to create the session. As you can see, our Chrome install is not in a standard location but I have validated the path to the binary. I have attached some detail below including system info, console output and the chrome log detail. I have tried several recommendations that have seen in various forums but none have made a difference
      Any assistance you can give would be greatly appreciated. 
      Thanks in advance, 
      chrome_Details.txt
    • By Danp2
      Introduction
      This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings.
      Requirements
      JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
      WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/
      HtmlTable2Array UDF (optional) https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/
      WebDriver for desired browser
      Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ Source Code
      You will always be able to find the latest version in the GitHub Repo 
      Help / Support
      See the wiki for details on the UDF --
      https://www.autoitscript.com/wiki/WebDriver
      Please post any questions, suggestions or errors in the GH&S thread.
      https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/
    • By Langmeister
      I am once again asking for your experienced assistance. If I open a website that uses notifications I am asked to allow or block them for that website after a few seconds. This notification pops up every time the page gets navigated to, even tho you have clicked on allow for several times. I am explicitly not searching for smth to get rid of "Chrome is being controlled by automated test sw". Instead I am searching for a line of script to disable all notifications by default: like here chrome://settings/content/notifications. 
      This is code should give you an example of what notifications I am talking about:
      #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession, $sID _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://webradio.planetradio.de/") _WD_LoadWait($sSession)  
    • By Langmeister
      Hi, I'm sure that this is a simple question regarding webdriver udf but my search on the forum did not result in the exact same scenario that I need. I will adapt it to my corporate needs but at first I want it to work with an example everybody can reproduce if needed.
      I navigate to https://www.daysoftheyear.com/ and want to find out what special day today is. Using the following Code returns the wanted text that today is 'shark awareness day' in the console but it is not pasted in notepad as it is not copied as it probably should be.
      #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession, $sID _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.daysoftheyear.com/?timezone_offset=nan") _WD_LoadWait($sSession) Sleep(3000) Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[2]/header/div/div[1]/div/div[2]/h3/a") _WD_ElementAction($sSession, $sElement, 'text') ClipGet() Run("notepad.exe") Sleep(500) Send("^v") Scite returns this, therefore the text has been found but the last mile to paste it to notepad or excel does not work for me.
      __WD_Get: URL=HTTP://127.0.0.1:9515/session/b72166b774d7fefb258b3721fc1d4306/element/657e6b5d-31a9-46a8-85c4-acb7f72bf659/text __WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"Shark Awareness Day"}... _WD_ElementAction: {"value":"Shark Awareness Day"}... Thanks in advance! 
       
    • By Langmeister
      Hi, I need help performing actions in Salesforce using IE. I used to complete tasks via MouseMove/MouseClick etc. on the Chrome application of SF, but unfortunately this only works for me and not my colleagues due to different positions of things etc. Being unable to get Webdriver UDF or Chromedriver running to interact with the code directly, I chose to look into the IE UDF. ATM I'm trying to tick a specific checkbox in SF which simply allows me to "select all checkboxes" at the same time. Applying the following code on a random website with checkboxes works just fine for me: (in this case selecting cheese checkbox)
      #include <IE.au3> Local $oIE = _IECreate("http://www.echoecho.com/htmlforms09.htm") Local $oSubmit = _IEGetObjByName($oIE, "option3") _IEAction($oSubmit, "click") _IELoadWait($oIE) But applying it to the Salesforce website it does exactly nothing and responds with these warnings/errors:
      The script is exactly the same, except for website and the input name tag of the desired checkbox being different.
      #include <IE.au3> Local $oIE = _IECreate("Corporate Salesforce URL") Local $oSubmit = _IEGetObjByName($oIE, "myPage:myForm:oliListBlock:oliListTable:j_id36") _IEAction($oSubmit, "click") _IELoadWait($oIE) As its working with random websites my guess is that there has to be something done to get it work with SF.
      Hope the more experienced SF+AutoIt pros can help me out here. Thanks in advance!
×
×
  • Create New...