Jump to content
Langmeister

Webdriver Salesforce unable to tick Checkbox

Recommended Posts

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:

Quote

--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: myPage:myForm:oliListBlock:oliListTable:j_id36, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType

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!

Edited by Langmeister

Share this post


Link to post
Share on other sites

I don't know SF, but here are a few basic things you can look into --

  • Does the site use frames?
  • Are you sure that is the correct element name?
  • Does the element have an Id that you can use instead of the name?

You may want to post the element's HTML so that we can see for ourselves.

P.S. If you share your experience with the Webdriver UDF, then I'm sure that we can figure out how to get it working for you

Share this post


Link to post
Share on other sites
On 7/3/2020 at 1:21 PM, Danp2 said:

I don't know SF, but here are a few basic things you can look into --

  • Does the site use frames?
  • Are you sure that is the correct element name?
  • Does the element have an Id that you can use instead of the name?

You may want to post the element's HTML so that we can see for ourselves.

P.S. If you share your experience with the Webdriver UDF, then I'm sure that we can figure out how to get it working for you

Thanks for the fast response, to your tips:

  • Don't know how to find that out, but guess so - what difference would that make?
  • Yes it is the correct element name, unfortunately it doesn't have any kind of id attached to it, just a parented table which i could try to adress

Anyways, if we get webdriver running it is probably going to work easier.

So I followed the guide which can be found in the Webdriver UDF Wiki and have put all the .au3 files (Json;Winhhtp;WD) in the includes folder of AutoIt as well as the chrome specific version of chromedriver in the above lying directory of AutoIt C:\Program Files (x86)\AutoIt3. 
Running wd_demo and choosing i.e. "Navigate" doesn't open Chrome but returns:  

Quote

_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WDStartup: OS:    WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.3.0.3 (Up to date)
_WDStartup: WinHTTP:    1.6.4.1
_WDStartup: Driver:    C:\Program Files (x86)\AutoIt3\chromedriver.exe
_WDStartup: Params:    --log-path="C:\Program Files (x86)\AutoIt3\Include\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/
__WD_Delete: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Delete ==> Webdriver Exception: WinHTTP request timed out before Webdriver
_WD_DeleteSession: WinHTTP request timed out before Webdriver
_WD_DeleteSession ==> Webdriver Exception: HTTP status = 0
>Exit code: 0    Time: 18.18
 

Already tried adding _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") to the code but this doesn't seem to fix the issue.
 

For later usage, that is the elements html:

<input name="myPage:myForm:oliListBlock:oliListTable:j_id36" title="Toggle All Rows" onchange="A4J.AJAX.Submit('myPage:myForm',event,{'similarityGroupingId':'myPage:myForm:oliListBlock:oliListTable:j_id37','parameters':{'myPage:myForm:oliListBlock:oliListTable:j_id37':'myPage:myForm:oliListBlock:oliListTable:j_id37'} ,'status':'myPage:myForm:oliListBlock:rerenderStatus'} )" type="checkbox" checked="checked">

Share this post


Link to post
Share on other sites
17 hours ago, Danp2 said:

Please see the troubleshooting section of the wiki, found here.

Good news - it works. I installed the 1.6.4.2 version of WinHttp of your stated wiki, specified the location of my chromedriver (C: ..) and found another pain point which had to be fixed in advance. While I was figuring out how to get the code running my company has updated the chrome version. Luckily the chromedriver for 83.0.4103.39 works fine with 83.0.4103.97  too so that the following script works fine for me. Just opening Chrome, navigating to Google, opening a new tab with yahoo on it  and focussing back at Google again.

#include "wd_core.au3"
#include "wd_helper.au3"

Local $sDesiredCapabilities, $sSession
_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, "http://google.com")
    _WD_NewTab($sSession)
    _WD_Navigate($sSession, "http://yahoo.com")

    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
    _WD_Attach($sSession, "google.com", "URL")

I'll try to apply it to my initial problem with Salesforce and if I need help I am going to hit the forum up again.

Share this post


Link to post
Share on other sites

Well here I am once more. And it is the same issue as in the beginning except for slightly different code I am using now. It works fine with other pages, but not with SF. It seems that I have to get into the frame, but my quick and dirty research hasn't helped me at this point to figure out how.

Here ticking Lettuce works perfectly:

#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.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html")

_WD_GetSource($sSession)
_WD_LoadWait($sSession)

Local $check = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='cond1']")
_WD_ElementAction($sSession, $check, 'click')

But again applying it to SF it ends up with errors:

#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, "Corporate SF URL")


_WD_GetSource($sSession)
_WD_LoadWait($sSession)

;Not working from this point on
;---------------------------------------------------------------------------------------------------------------------
;Local $check = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='j_id36']")
;_WD_ElementAction($sSession, $check, 'click')

If you need further information let me know.

Share this post


Link to post
Share on other sites

Btw these are the errors I'm receiving:
In short (no such element/Unable to locate element/no match)

__WD_Post: URL=HTTP://127.0.0.1:9515/session/fb9fe9a9afb92df26e6d16e7c029921c/element; $sData={"using":"xpath","value":"//input[@id='j_id36']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//input[@id='j_id36']\"}\n  (Session info: chrome=83.0.4103.97)","stacktrace":"Backtrace:\n\tOrdinal0 [0x015A9563+2725219]\n\tOrdinal0 [0x014A8551+1672529]\n\tOrdinal0 [0x01390359+525145]\n\tOrdinal0 [0x01329755+104277]\n\tOrdinal0 [0x013453C0+218048]\n\tOrdinal0 [0x0133AAD0+174800]\n\tOrdinal0 [0x01343D7C+212348]\n\tOrdinal0 [0x0133A94B+174411]\n\tOrdinal0 [0x01322528+75048]\n\tOrdinal0 [0x013235A0+79264]\n\tOrdinal0 [0x01323539+79161]\n\tOrdinal0 [0x014BD607+1758727]\n\tGetHandleVerifier [0x016C6546+1050150]\n\tGetHandleVerifier [0x016C6291+1049457]\n\tGetHandleVerifier [0x016D10D7+1094071]\n\tGetHandleVerifier [0x016C6B46+1051686]\n\tOrdinal0 [0x014B5B06+1727238]\n\tOrdinal0 [0x014BEB7B+1764219]\n\tOrdinal0 [0x014BECE3+1764579]\n\tOrdinal0 [0x014D4C05+1854469]\n\tBaseThreadInitThunk [0x77148494+36]\n\tRtlAreBitsSet [0x77B04328+136]\n\tRtlAreBitsSet [0x77B042F8+88]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/fb9fe9a9afb92df26e6d16e7c029921c/element//click; $sData={"id":""}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_ElementAction: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_ElementAction ==> No match: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=83.0.4103.97)","stacktrace":"Backtrace:\n\tOrdinal0 [0x015A9563+2725219]\n\tOrdinal0 [0x014A8551+1672529]\n\tOrdinal0 [0x01390359+525145]\n\tOrdinal0 [0x01329090+102544]\n\tOrdinal0 [0x0132A3BB+107451]\n\tOrdinal0 [0x013242EF+82671]\n\tOrdinal0 [0x0133AA9D+174749]\n\tOrdinal0 [0x013241F6+82422]\n\tOrdinal0 [0x0133ACE1+175329]\n\tOrdinal0 [0x01343D7C+212348]\n\tOrdinal0 [0x0133A94B+174411]\n\tOrdinal0 [0x01322528+75048]\n\tOrdinal0 [0x013235A0+79264]\n\tOrdinal0 [0x01323539+79161]\n\tOrdinal0 [0x014BD607+1758727]\n\tGetHandleVerifier [0x016C6546+1050150]\n\tGetHandleVerifier [0x016C6291+1049457]\n\tGetHandleVerifier [0x016D10D7+1094071]\n\tGetHandleVerifier [0x016C6B46+1051686]\n\tOrdinal0 [0x014B5B06+1727238]\n\tOrdinal0 [0x014BEB7B+1764219]\n\tOrdinal0 [0x014BECE3+1764579]\n\tOrdinal0 [0x014D4C05+1854469]\n\tBaseThreadInitThunk [0x77148494+36]\n\tRtlAreBitsSet [0x77B04328+136]\n\tRtlAreBitsSet [0x77B042F8+88]\n"}}

 

Share this post


Link to post
Share on other sites
43 minutes ago, Langmeister said:

_WD_GetSource($sSession)

You had this in both of your examples. It is unnecessary unless you need to access the raw source. In that case, you would store the result in a variable.

46 minutes ago, Langmeister said:

;Not working from this point on

Again, I don't know SF, but if the site uses frames, then you need to switch to the correct one before the element can be located. Have you looked at the DemoFrames function in wd_demo.au3 for an example of how this should work?

Also, I would suggest that you take a look at the ChroPath extension, which can possible help you identify the correct xpath for a given element.

Share this post


Link to post
Share on other sites
16 hours ago, Danp2 said:

You had this in both of your examples. It is unnecessary unless you need to access the raw source. In that case, you would store the result in a variable.

Again, I don't know SF, but if the site uses frames, then you need to switch to the correct one before the element can be located. Have you looked at the DemoFrames function in wd_demo.au3 for an example of how this should work?

Also, I would suggest that you take a look at the ChroPath extension, which can possible help you identify the correct xpath for a given element.

Ok I will delete the line with Getsource. In the meantime I found out that SF is definetly using Frames which made it not working the easy way. I tried ChroPath but unfortunately it works with every other website except for SF. I am convinced that this doesn't take much more than the following code that is similar to what I want. Here it navigates to the website and clicks onto "Updating for Mobile" within the Iframe.

#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, "http://allwebco-templates.com/support/S_script_IFrame.htm")
ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[2]")
_WD_FrameEnter($sSession, $sElement)
Sleep(5000)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html[1]/body[1]/div[1]/div[8]/div[1]/div[1]/a[1]")
_WD_ElementAction($sSession, $sElement, 'click')

You said I need to switch to the correct frame, but how do I adress the following  XPath like the $sElement in "//iframe[2]
Like is it possible to use the ID "sectioncontent-1499" for that?

;XPath According to Chrome
//*[@id="sectionContent-1499"]/div/slot/force-record-layout-row/slot/force-record-layout-item/div/div/div/span/slot[2]/force-aloha-page/div/iframe

;FUll XPath according to Chrome
/html/body/div[4]/div[1]/section/div/div/div[1]/div[2]/div/one-record-home-flexipage2/forcegenerated-flexipage_opportunity_record_page1_opportunity__view_js/flexipage-record-page-decorator/div/slot/flexipage-record-home-with-subheader-template-desktop2/div/div[3]/div[1]/slot/slot/flexipage-component2/force-progressive-renderer/slot/slot/flexipage-tabset2/div/lightning-tabset/div/slot/slot/slot/flexipage-tab2[2]/slot/flexipage-component2/force-progressive-renderer/slot/slot/records-lwc-detail-panel/records-base-record-form/div/div/div/records-record-layout-event-broker/slot/records-lwc-record-layout/forcegenerated-detailpanel_opportunity___012b0000000cw6kaae___full___view___recordlayout2/force-record-layout-block/slot/force-record-layout-section[20]/div/div/div/slot/force-record-layout-row/slot/force-record-layout-item/div/div/div/span/slot[2]/force-aloha-page/div/iframe

;The copied element from html
<iframe force-alohapage_alohapage="" height="500px" width="100%" scrolling="no" allowtransparency="true" name="vfFrameId_1594192229873" title="accessibility title" allowfullscreen="true" lang="en-US" allow="geolocation *; microphone *; camera *"></iframe>

 

Share this post


Link to post
Share on other sites

@Danp2 The demo you suggested is this:

Local $sElement

    _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_frame_cols")
    ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='iframeResult']")
    _WD_FrameEnter($sSession, $sElement)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    _WD_FrameLeave($sSession)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)

Adapting it to another website looks like this for me:

#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.w3schools.com/html/html_iframe.asp")
    ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='main']")
    _WD_FrameEnter($sSession, $sElement)
    Sleep(5000)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[4]/div/div[1]/a[2]")
_WD_ElementAction($sSession, $sElement, 'click')

It opens the website and clicks on the home button of the website to have smth to click on.
This results in these responds:

__WD_Post: URL=HTTP://127.0.0.1:9515/session/7fc66e79c512e2c95360b95f5d1e5886/element; $sData={"using":"xpath","value":"//iframe[@id='main']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//iframe[@id='main']\"}\n  (Session info: chrome=83.0.4103.97)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00AF9563+2725219]\n\tOrdinal0 [0x009F8551+1672529]\n\tOrdinal0 [0x008E0359+525145]\n\tOrdinal0 [0x00879755+104277]\n\tOrdinal0 [0x008953C0+218048]\n\tOrdinal0 [0x0088AAD0+174800]\n\tOrdinal0 [0x00893D7C+212348]\n\tOrdinal0 [0x0088A94B+174411]\n\tOrdinal0 [0x00872528+75048]\n\tOrdinal0 [0x008735A0+79264]\n\tOrdinal0 [0x00873539+79161]\n\tOrdinal0 [0x00A0D607+1758727]\n\tGetHandleVerifier [0x00C16546+1050150]\n\tGetHandleVerifier [0x00C16291+1049457]\n\tGetHandleVerifier [0x00C210D7+1094071]\n\tGetHandleVerifier [0x00C16B46+1051686]\n\tOrdinal0 [0x00A05B06+1727238]\n\tOrdinal0 [0x00A0EB7B+1764219]\n\tOrdinal0 [0x00A0ECE3+1764579]\n\tOrdinal0 [0x00A24C05+1854469]\n\tBaseThreadInitThunk [0x769E8494+36]\n\tRtlAreBitsSet [0x77A84328+136]\n\tRtlAreBitsSet [0x77A842F8+88]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7fc66e79c512e2c95360b95f5d1e5886/frame; $sData={"id":{"element-6066-11e4-a52e-4f735466cecf":""}}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_Window: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_Window ==> No match: HTTP status = 404
_WD_FrameEnter ==> Webdriver Exception
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7fc66e79c512e2c95360b95f5d1e5886/element; $sData={"using":"xpath","value":"/html/body/div[4]/div/div[1]/a[2]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"3f1fba85-91a0-413f-9c68-13524d76d902"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"3f1fba85-91a0-413f-9c68-13524d76d902"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7fc66e79c512e2c95360b95f5d1e5886/element/3f1fba85-91a0-413f-9c68-13524d76d902/click; $sData={"id":"3f1fba85-91a0-413f-9c68-13524d76d902"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...

Leaving the below two lines out erases the two 404 errors and still clicks, but again applying it only using the full xpath as $sElement doesn't work with SF.

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='main']")
    _WD_FrameEnter($sSession, $sElement)

Maybe @Bert or @BigDaddyO know how to apply this to Salesforce.
In Specific I want to adress the Offerings (OLI) which can be found within an iFrame.

Edited by Langmeister

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Hermes
      Hi, I have a site that has the following elements below: 
      <div>More element here</div> <div>More element here</div> <div>More element here</div> When I do this in Auto It:
      Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div") _WD_HighlightElement($sSession, $oSelectDiv, 1) I also tried to add [3], but it doesnt seems to work:
      Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div[3]") _WD_HighlightElement($sSession, $oSelectDiv, 1) It always highlight the first one, but I am trying to highlight the 3rd in the list. Is there anyway to select the 3rd div without having to add any class/id in the divs, and without using XPATH? The structure of the elements in that site were built that way.
    • By ReM
      Hallo Experts,
      Your testsite and the examples are very good. Thanks a lot.  
      I used your example with Chromewebdriver. The Chrome Browser open, the site will shown, but all other functions not executed.
      The Chomedriver.exe Windows shows this text:
      Starting ChromeDriver 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430@{#429}) on port 9515 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. DevTools listening on ws://127.0.0.1:54044/devtools/browser/3c17aefd-a104-43e7-8c17-318963cda872 [12848:3100:0501/153128.889:ERROR:device_event_log_impl.cc(214)] [15:31:28.888] USB: usb_device_handle_win.cc:1054 Failed to read descriptor from node connection: Ein an das System angeschlossenes Gerõt funktioniert nicht. (0x1F) [12848:3100:0501/153128.896:ERROR:device_event_log_impl.cc(214)] [15:31:28.896] USB: usb_device_handle_win.cc:1054 Failed to read descriptor from node connection: Ein an das System angeschlossenes Gerõt funktioniert nicht. (0x1F) The Error :  A devise connected to the systen does not work (0x1F)
      Win 10
      Chrome & Driver 90
      What i do wrong. Can you help me?
      Reiner
       
       
    • 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/205553-webdriver-udf-help-support-iii/
      Previous support threads (Closed)
      https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/
      https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/
       
    • By TheOne23
      Hi Danp2,
       
      May I seek your a help and assistance why the page to download the chrome driver version 89 is not accessible.
      Getting below error page:

       
      Thanks in advance.
      TheOne23
    • By Hermes
      I have an html table that displays data along with an excel spreadsheet that has the same data as the html table. I am wanting to only match the Title column in my html table with the Title column in my Excel spreadsheet. If the titles match, click on the Edit hyperlink and continue to loop to next row. The issue I'm experience is its not matching correctly. So far  i've written the codes below:
      <table border="1" class="test"> <tr> <th> UniqueID</th> <th> Title</th> <th> UserID</th> <th> Address</th> <th> Gender </th> </tr> <tr> <td> 1 </td> <td> Title1 </td> <td> 12345 </td> <td> Manila </td> <td> <span> Male </span> </td> </tr> <tr> <td align="center" colspan="5"> <a href="#" class="testlink">Edit</a> </td> </tr> <tr> <td> 2 </td> <td> Title2 </td> <td> 67891 </td> <td> Valenzuela </td> <td> <span> Female </span> </td> </tr> <tr> <td align="center" colspan="5" > <a href="#" class="testlink">Edit</a> </td> </tr> <tr> <td> 3 </td> <td> Title3 </td> <td> 88888 </td> <td> Ohio </td> <td> <span> Male </span> </td> </tr> <tr> <td align="center" colspan="5" > <a href="#" class="testlink">Edit</a> </td> </tr> <tr> <td> 4 </td> <td> Title4 </td> <td> 77777 </td> <td> California </td> <td> <span> Female </span> </td> </tr> <tr> <td align="center" colspan="5" > <a href="#" class="testlink">Edit</a> </td> </tr> <tr> <td> 5 </td> <td> Title5 </td> <td> 33333 </td> <td> Arizona </td> <td> <span> Male </span> </td> </tr> <tr> <td align="center" colspan="5" > <a href="#" class="testlink">Edit</a> </td> </tr> </table> #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "Excel.au3" #Include "_HtmlTable2Array.au3" #Include "Array.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "index.html") Sleep(6000) Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, "test.xlsx") ; Get the table element $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='test']") ; Retrieve HTML $sHTML = _WD_ElementAction($sSession, $sElement, "Property", "outerHTML") ;Local $aTable = _HtmlTableGetWriteToArray($sHTML) Local $aArray1 = _Excel_RangeRead($oWorkbook,1,$oWorkbook.ActiveSheet.Usedrange.Columns("B:B")) Local $aArray2 = _HtmlTableGetWriteToArray($sHTML) ;_ArrayDisplay($aArray1) ;_ArrayDisplay($aArray2) For $i = UBound($aArray1) - 1 To 0 step - 1 For $j = UBound($aArray2) - 1 to 0 step - 1 If $aArray1[$i][1] == $aArray2[$j][1] Then _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//a[contains(@class,'testlink') or contains(text(),'Edit')]") $test1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[contains(@class,'testlink') or contains(text(),'Edit')]") _WD_ElementAction($sSession, $test1, 'click') ;_ArrayDisplay($aArray1) ;_ArrayDelete($aArray1 , $i) ;exitloop EndIf Next Next _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 Would appreciate if anyone can provide tips, or point me in the right direction in doing it.
       
      test.xlsx
×
×
  • Create New...