0

I thought I could figure this out based on an excellent answer that Yu Zhou gave me in response to my previous question on this same topic [https://stackoverflow.com/questions/63677723/excel-ie-automation-identifying-a-css-element] enter image description here From the picture above what I'm trying to accomplish is to press the "Block & Lot" tab so that I can enter the search criteria into the proper fields and activate the search button to find it.

The code that I have so far is:

  htmlDoc.getElementById("ext-comp-1072__ext-comp-1073").setAttribute "class", ""
' Next line selects the "Block & Lot" tab
  htmlDoc.getElementById("ext-comp-1072__ext-comp-1079").setAttribute "class", "x-tab-strip-active"
' Next line hides the "Address/Borough" fields
  htmlDoc.getElementById("ext-comp-1073").setAttribute "class", "x-panel x-panel-noborder x-hide-display"

Which gets me to the point where the "Block & Lot" tab is activated (or so I believe it is) but whatever I try I can't get the fields below ('select a borough', 'enter block' and 'enter lot') to appear so that I can enter data into them. The html code for this section of the website is below:

<div id="ext-comp-1071" style="left: 150px; bottom: 0px; position: absolute;">
<div class=" x-tab-panel search-tab" id="ext-comp-1072" style="width: 510px;">
<div class="x-tab-panel-header x-unselectable x-tab-panel-header-plain" id="ext-gen79" style="width: 510px;">
<div class="x-tab-strip-wrap" id="ext-gen82">
<ul class="x-tab-strip x-tab-strip-top" id="ext-gen84">
<li id="ext-comp-1072__ext-comp-1073">
<a class="x-tab-strip-close" id="ext-gen87"></a>
<a class="x-tab-right" id="ext-gen88" href="#">
<em class="x-tab-left">
<span class="x-tab-strip-inner">
<span class="x-tab-strip-text ">Address</span>
     </span></em></a></li>
<li class="x-tab-strip-active" id="ext-comp-1072__ext-comp-1079">
<a class="x-tab-strip-close" id="ext-gen89"></a>
<a class="x-tab-right" id="ext-gen90" href="#">
<em class="x-tab-left">
<span class="x-tab-strip-inner">
<span class="x-tab-strip-text ">Block & Lot</span>
     </span></em></a></li>
<li id="ext-comp-1072__ext-comp-1087">
<a class="x-tab-strip-close" id="ext-gen91"></a>
<a class="x-tab-right" id="ext-gen92" href="#">
<em class="x-tab-left">
<span class="x-tab-strip-inner">
<span class="x-tab-strip-text ">ZIP Code</span>
    </span></em></a></li>
John Wilson
  • 100
  • 1
  • 7
  • 1
    *where the "Block & Lot" tab is activated (or so I believe it is)* are you sure? that makes quite a difference – Foxfire And Burns And Burns Sep 08 '20 at 00:17
  • Normal operation is press the Block/Lot, it turns white, the Addr and Boro fields disappear and are automatically replaced by the appropriate fields for the Block/Lot. With the code Yu Zhou gave me from a previous post, I can turn that Block/Lot button white, I can make the Address/Boro fields disappear but I can't get the Block/Lot/Boro fields to appear. Without changing the class of the tabs, if I were actually able to "click" the Block/Lot tab, everything else should take care of itself automatically. So no, I'm not sure because I guess I don't fully understand how the code works. – John Wilson Sep 08 '20 at 00:57
  • there are a lot of event listeners to consider if going down the click route. You can get some idea by inspecting in elements tab or selecting your element and then in console entering _monitorEvents($0)_ then perform your task. Use _unmonitorEvents($0)_ to switch off. Personally, I would use selenium automation for this kind of page or XHR. – QHarr Sep 08 '20 at 06:16
  • I try to test with the above mentioned site and found that by changing the class it will just change the appearance of the tab. Note that it is not selected. I also try various approaches to click the tab but all approaches get failed. If you manually click the tab and inspect the elements to fill the values then you can notice that they don't contains the 'value' parameter. so setting the value will not work here. I suggest check with the site whether they provide any API to fetch the data or try to make a test with the Selenium web driver. – Deepak-MSFT Sep 08 '20 at 07:00
  • Does the fact that the event from that tab changes to "over" indicate that there's a mouse over event going on? Would there be any way to set a mouse down or mouse click to activate the tab? I have zero knowledge of HTML at this point (but picking up tidbits as I go along) so if that's a stupid question, don't beat me up too harshly for asking. – John Wilson Sep 09 '20 at 16:30
  • I have tried to fire the events but it didn't worked. Did you tried to use the Selenium web driver? – Deepak-MSFT Sep 11 '20 at 02:53

0 Answers0