Jump to content

Recommended Posts

Posted

I am having trouble finding a good way to click these "button" below. 

image.png.79cfccdc339818423974807f892b9f8a.png

I only need to be able to click them when they have both yes/no. Otherwise I don't have to worry about them. For instance if they looked like this I would NOT have worry about clicking them and can just ignore them all togheter.(Below Picture)

image.png.2a82fa8d6bd12395db1991f0b443df49.png

The problem is as mentioned in the title, all of the ID's  are dynamic. (Classes too)

image.thumb.png.b6408eef8fcc0faa00459d55495a5ba9.png

Here is what it looks like if yes is already selected.

image.thumb.png.7ee78a1716ac60bba62d4d4a18eda7a2.png

This is what I was using to select the the button. However, I need to know if the button has already been clicked/selected or not.

_WD_LoadWait($sSession)
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text() = 'Offered access to electronic health information?']")         
    Sleep(1000)
    _WD_ElementAction($sSession, $sElement, 'click')
    Sleep(500)
    _WD_Action($sSession, "actions", $sActionTab)
    Sleep(500)
    _WD_Action($sSession, "actions", $sActionEnter)

Is there a way I can get the count of spans in the span class-"s_636" by tabbing over to the button? I am hoping someone might have some ideas on what I can try.

Unfortunally, The site is for work so giving the site wont do any good. 

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted

You can check if both span text exist. 

//div/div/span[span[contains(text(), "Yes")] and span[contains(text(), "No")]]

 

Saludos

Posted

Really appricate the help. 

That worked! Kinda. 

Is there a way I can ditinguish between the "Offered Access to Electronic Health" and "ACO leterr accepted" usign this method? I would like to avoid using the full xpath. Kind of my last resort really. 

Full X'path's

;Offerd Full Box
/html/body/div[2]/div[7]/div[2]/div[8]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div/div[4]/div/div/div/div/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div/table/tbody/tr/td[3]/div/div/span

;Offered Yes
/html/body/div[2]/div[7]/div[2]/div[8]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div/div[4]/div/div/div/div/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div/table/tbody/tr/td[3]/div/div/span/span[1]

;Offered No
/html/body/div[2]/div[7]/div[2]/div[8]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div/div[4]/div/div/div/div/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div/table/tbody/tr/td[3]/div/div/span/span[2]

;ACO Full Box
/html/body/div[2]/div[7]/div[2]/div[8]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div/div[4]/div/div/div/div/div/div/div/div[2]/div/div/div/div[2]/div/div/div/div/table/tbody/tr/td[3]/div/div/span

;ACO Yes
/html/body/div[2]/div[7]/div[2]/div[8]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div/div[4]/div/div/div/div/div/div/div/div[2]/div/div/div/div[2]/div/div/div/div/table/tbody/tr/td[3]/div/div/span/span[1]

;ACO No
/html/body/div[2]/div[7]/div[2]/div[8]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div/div[4]/div/div/div/div/div/div/div/div[2]/div/div/div/div[2]/div/div/div/div/table/tbody/tr/td[3]/div/div/span/span[2]

 

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted

Did you try _WD_GetElementByRegEx()

.?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

@mLipok I have been spending the better part of the day trying to grasp how regex works. I have gotten to the point where I can find "yes" and "no" and "offered access" ,etc. Using regex101.com with ECMAscript and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions.  However, I am still not sure how I can find/specify only the yes and no below offered access or ACO Letter accepted and again only when both exist do I need to click it. 

image.thumb.png.b484bb335d66bf0b7fc0179621ecb3b0.png

image.png.024e702ca44bafff95b1ec6b389f4529.png

 

<div id="xiy_g-4" class="pn-i pn-i-flop" style="width: 100%;"><div id="xiy_1o" class="comp comp-g navcomp horiz pn pn-c pn-s" style="width: 100%;"><div id="xiy_1o-0" class="pn-i " style="padding-left: 2.2ex; width: 100%;"><div id="xiy_1p" class="comp comp-g navcomp pn pn-c pn-s vert" style="width: 100%;"><div id="xiy_1p-0" class="pn-i  s_85" style="width: 100%;"><div id="xiy_1q" class="pn-c navcomp s_39" data-navcomp-type="accordioncontrol"><div id="xiy_1q-sc" class="pn-w s_86" style="width: 100%;"><div id="xiy_1q-pn" class="pn pn-flop ec-bdy vert pinned-scroll s_87"><div class="pinned-spacer pn-i pn-i-flop link" data-pinned-spacer-for="yiy_2g" style="height: 36px;"></div><div id="yiy_1r" class="pn-i pn-i-flop ec-det persistent-data" role="region" aria-labelledby="xiy_2h-2-btn"><div id="xiy_1s" class="comp navcomp sc-n pn-c"><div id="xiy_1s-pn" class="comp-g pn pn-s horiz" style="width: 100%;"><div id="xiy_1t" class="comp comp-g navcomp pn pn-c pn-t vert persistent-data" style="width: 100%; table-layout:fixed;"><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_1u" class="comp rttable navcomp s_50 s_72 s_88 s_89 s_90 s_91 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_1u-t" class="s_100 recordtable" data-last-label-spanned-widths="47.00%" data-last-label-initial-width="47.00%" data-column-count="4" data-render-type="TM" data-registered-events=""><div id="xiy_1u-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_1u-bd" class="rtbody">  <colgroup><col class="col0"><col class="col1"><col class="col2"><col class="col3"></colgroup>  <tbody><tr id="yiy_1v" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_1w" class=" rtcell column0 rtdispblank"><div class="s_63">  <span class="s_92 rectbl-text">  &nbsp;  </span></div></td><td id="yiy_1x" class="s_98 rtcell column1"><div class="s_63"><div id="xiy_1y" class="flowcomp comp navcomp s_15"><span class="s_15"><span class="s_392">* </span><span class="s_94">Offered access to electronic health information?</span><span class="s_95"></span></span></div></div></td><td id="yiy_1z" class="s_98 rtcell column2 link" data-evt="C"><div class="s_99"><div id="xiy_20" class="flowcomp comp navcomp s_15"><span class="s_96"><span id="xiy_20-mL" data-evt="C" class="link navitem s_393" tabindex="0">Yes</span><span id="xiy_20-mM" data-evt="C" class="link navitem s_394" tabindex="0">No</span></span></div></div></td><td id="yiy_21" class=" rtcell column3 link" data-evt="C"><div class="s_63"><div id="xiy_22" class="comp rectbl-text-comp navcomp"><span id="xiy_22-s" class="s_8 rectbl-text">&nbsp;</span></div></div></td></tr>  </tbody></table></div></div></div></div></div><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_CM" class="comp rttable navcomp s_50 s_72 s_88 s_89 s_90 s_91 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_CM-t" class="s_100 recordtable" data-last-label-spanned-widths="47.00%" data-last-label-initial-width="47.00%" data-column-count="4" data-render-type="TM" data-registered-events=""><div id="xiy_CM-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_CM-bd" class="rtbody">  <colgroup><col class="col0"><col class="col1"><col class="col2"><col class="col3"></colgroup>  <tbody><tr id="yiy_CN" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_CO" class=" rtcell column0 rtdispblank"><div class="s_63">  <span class="s_92 rectbl-text">  &nbsp;  </span></div></td><td id="yiy_CP" class="s_98 rtcell column1"><div class="s_63"><div id="xiy_CQ" class="flowcomp comp navcomp s_15"><span class="s_15"><span class="s_392">* </span><span class="s_94">ACO Letter Accepted?</span><span class="s_95"></span></span></div></div></td><td id="yiy_CR" class="s_98 rtcell column2 link rtfocus" data-evt="C"><div class="s_99"><div id="xiy_CS" class="flowcomp comp navcomp s_15"><span class="s_96"><span id="xiy_CS-mR" data-evt="C" class="link navitem s_393" tabindex="0">Yes</span><span id="xiy_CS-mS" data-evt="C" class="link navitem s_394" tabindex="0">No</span></span></div></div></td><td id="yiy_CT" class=" rtcell column3 link" data-evt="C"><div class="s_63"><div id="xiy_CU" class="comp rectbl-text-comp navcomp"><span id="xiy_CU-s" class="s_8 rectbl-text">&nbsp;</span></div></div></td></tr>  </tbody></table></div></div></div></div></div><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_CX" class="comp rttable navcomp s_112 s_113 s_114 s_50 s_72 s_88 s_89 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_CX-t" class="s_100 recordtable" data-last-label-spanned-widths="45.00%" data-last-label-initial-width="45.00%" data-column-count="5" data-render-type="TM" data-registered-events=""><div id="xiy_CX-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_CX-bd" class="rtbody">  <colgroup><col class="col0"><col class="col1"><col class="col2"><col class="col3"><col class="col4"></colgroup>  <tbody><tr id="yiy_CY" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_CZ" class=" rtcell column0 rtdispblank"><div class="s_63">  <span class="s_92 rectbl-text">  &nbsp;  </span></div></td><td id="yiy_Ca" class="s_98 rtcell column1"><div class="s_63"><div id="xiy_Cb" class="flowcomp comp navcomp s_15"><span class="s_15"><span class="s_93">* </span><span class="s_94">Date:</span><span class="s_95"></span></span></div></div></td><td id="yiy_Cc" class="s_98 rtcell column2 link" data-evt="C"><div class="s_63"><div id="xiy_Cd" data-evt="C" data-evh="Pweb.event.incrementClickCount" class="comp navcomp s_115"><input id="xiy_Cd-i" type="text" spellcheck="false" autocomplete="off" maxlength="" style="box-sizing:border-box;width:100%;vertical-align:top;" name="iniy_79" value="09/15/22" class="navitem s_116" data-fieldchanged-url="./00000000000226tcca.mthd"></div></div></td><td id="yiy_Ce" class="s_102 rtcell column3 link" data-evt="C"><div class="s_63"><div id="xiy_Cf" class="flowcomp comp navcomp s_31"><span class="s_31"><img id="xiy_Cf-mG" data-evt="C" class="navitem link" tabindex="0" src="Pub/Web/Icon/CalendarSmall.png" alt="Date" title="Date"></span></div></div></td><td id="yiy_Cg" class=" rtcell column4 link" data-evt="C"><div class="s_63"><div id="xiy_Ch" class="comp rectbl-text-comp navcomp"><span id="xiy_Ch-s" class="s_8 rectbl-text">&nbsp;</span></div></div></td></tr>  </tbody></table></div></div></div></div></div><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_25" class="comp rttable navcomp s_101 s_50 s_72 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_25-t" class="s_100 recordtable" data-last-label-spanned-widths="100.00%" data-last-label-initial-width="100%" data-column-count="1" data-render-type="TM"><div id="xiy_25-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_25-bd" class="rtbody">  <colgroup><col class="col0"></colgroup>  <tbody><tr id="yiy_26" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_27" class=" rtcell column0 rtdispblank"><div class="s_63">  <span class="s_8 rectbl-text">  &nbsp;  </span></div></td></tr>  </tbody></table></div></div></div></div></div><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_2A" class="comp rttable navcomp s_101 s_50 s_72 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_2A-t" class="s_100 recordtable" data-last-label-spanned-widths="100.00%" data-last-label-initial-width="100%" data-column-count="1" data-render-type="TM"><div id="xiy_2A-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_2A-bd" class="rtbody">  <colgroup><col class="col0"></colgroup>  <tbody><tr id="yiy_2B" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_2C" class="s_102 rtcell column0"><div class="s_63"><div id="xiy_2D" class="flowcomp comp navcomp s_31"><span class="s_31"><span>Financial Counsel</span></span></div></div></td></tr>  </tbody></table></div></div></div></div></div><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_2G" class="comp rttable navcomp s_103 s_50 s_72 s_88 s_89 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_2G-t" class="s_100 recordtable" data-last-label-spanned-widths="70.00%" data-last-label-initial-width="70.00%" data-column-count="3" data-render-type="TM" data-registered-events=""><div id="xiy_2G-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_2G-bd" class="rtbody">  <colgroup><col class="col0"><col class="col1"><col class="col2"></colgroup>  <tbody><tr id="yiy_2H" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_2I" class=" rtcell column0 rtdispblank"><div class="s_63">  <span class="s_92 rectbl-text">  &nbsp;  </span></div></td><td id="yiy_2J" class="s_98 rtcell column1"><div class="s_63"><div id="xiy_2K" class="flowcomp comp navcomp s_15"><span class="s_15"><span class="s_93"></span><span class="s_94">NSB Disclosure provided</span><span class="s_95"></span></span></div></div></td><td id="yiy_2L" class="s_98 rtcell column2 link" data-evt="C"><div class="s_111"><div id="xiy_2M" class="comp navcomp s_109"><div id="xiy_2M-h" class="s_110 navitem" tabindex="0"><span class="vcenterhelper"></span><span id="xiy_2M-s" class="vcenterelement idp-display">Yes</span><input id="xiy_2M-i" name="iniy_39" type="text" style="display:none;" value="Yes" readonly=""></div></div></div></td></tr>  </tbody></table></div></div></div></div></div><div class="pn-row"><div class="pn-i pn-cell" style="padding-left: 2%; width: 95%;"><div id="xiy_2P" class="comp rttable navcomp s_112 s_113 s_114 s_50 s_72 s_88 s_89 s_65 afterResize persistent-data" data-after-resize="Pweb.comp.recordTable.afterResize_" data-navcomp-type="recordtable" data-evt="Ch C Fi Fo De" data-evh="Pweb.comp.recordTable.event"><div id="xiy_2P-t" class="s_100 recordtable" data-last-label-spanned-widths="45.00%" data-last-label-initial-width="45.00%" data-column-count="5" data-render-type="TM" data-registered-events=""><div id="xiy_2P-sc" class="s_80 rtscrollbody" style="overflow-y: hidden;"><table id="xiy_2P-bd" class="rtbody">  <colgroup><col class="col0"><col class="col1"><col class="col2"><col class="col3"><col class="col4"></colgroup>  <tbody><tr id="yiy_2Q" class="rtrow navcomp selected" data-navcomp-type="recordtablerow"><td id="yiy_2R" class=" rtcell column0 rtdispblank"><div class="s_63">  <span class="s_92 rectbl-text">  &nbsp;  </span></div></td><td id="yiy_2S" class="s_98 rtcell column1"><div class="s_63"><div id="xiy_2T" class="flowcomp comp navcomp s_15"><span class="s_15"><span class="s_93"></span><span class="s_94">NSB Disclosure date</span><span class="s_95"></span></span></div></div></td><td id="yiy_2U" class="s_98 rtcell column2 link" data-evt="C"><div class="s_63"><div id="xiy_2V" data-evt="C" data-evh="Pweb.event.incrementClickCount" class="comp navcomp s_115"><input id="xiy_2V-i" type="text" spellcheck="false" autocomplete="off" maxlength="" style="box-sizing:border-box;width:100%;vertical-align:top;" name="iniy_40" value="04/13/22" class="navitem s_116" data-fieldchanged-url="./0000000000016bpyjd.mthd"></div></div></td><td id="yiy_2W" class="s_102 rtcell column3 link" data-evt="C"><div class="s_63"><div id="xiy_2X" class="flowcomp comp navcomp s_31"><span class="s_31"><img id="xiy_2X-m2" data-evt="C" class="navitem link" tabindex="0" src="Pub/Web/Icon/CalendarSmall.png" alt="Date" title="Date"></span></div></div></td><td id="yiy_2Y" class=" rtcell column4 link" data-evt="C"><div class="s_63"><div id="xiy_2Z" class="comp rectbl-text-comp navcomp"><span id="xiy_2Z-s" class="s_8 rectbl-text">&nbsp;</span></div></div></td></tr>  </tbody></table></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted

No luck, The site only works on our network. 

I would try an extension, but our IT has all extensions blocked.

Is there a manual way to do this?

I am gussing I am going to have to use the full xpath at this point. Which is fine I guess, it just breaks everytime we get and upadate to the site. >.<

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted (edited)

hello @SkysLastChance
Can you save it to single MHTLM file and share it to us ? Of course there will be a need to anonymize the restricted data but this is a way to show as how this page looks like.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I was able to figure this out with alot of help from my co-worker using java script. 

Local $Text = 'ACO Letter Accepted?'
Local $Java = _WD_ExecuteScript($sSession,'var questionRow = Array.prototype.slice.call(document.querySelectorAll("div.pn-row tr")).find(element => element.querySelectorAll("td.column1 span span")[1].innerHTML == "' & $vText &'");return questionRow.querySelectorAll("td.column2 span span").length == 1;',Default,Default,"[value]")
Msgbox(0,"",$Java)

Thanks @Danp2 and @mLipok for all the help in the last couple years.

The webdriver udf's and wiki have been paramount in automating chrome for me.  Can't thank you both enough. 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

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
×
×
  • Create New...