chromefindelements returning array of hexadecimal instead of links
Moderators: Dorian (MJT support), JRL
chromefindelements returning array of hexadecimal instead of links
Having trouble with chromefindelements.
I'm running:
ChromeFindElements>hIE,xpath,//div[@class='title']/a,arrElementID
ChromeElementAction>hIE,arrElementID_1,click
on the following. It's a long list, so only a snippet:
<...>
<div class="piece column span-16 even">
<div class="column span-11">
<div class="column span-11 last">
<div class="title">
<a href="/pieces/495920-770-hycean-worlds">770- Hycean Worlds</a>
<div class="subtitle">Are Sub-Neptune Planets an Abode of Life?
</div>
</div>
From:
<a href="/users/213240-travelersinthenight">Albert Grauer</a>
<br/>
Series:
<a href="https://exchange.prx.org/series/33698-t ... >Travelers In The Night</a>
<br/>
</div>
<div class="column span-2">
<a href="/pieces/495920-770-hycean-worlds"><img alt="Caption: This artist’s concept shows what exoplanet K2-18 b could look like based on science data., Credit: NASA, CSA, ESA, J. Olmsted (STScI), Science: N. Madhusudhan (Cambridge University)" src="https://s3.amazonaws.com/production.med ... square.png" style="float: left" version="square" width="75" /></a>
</div>
<div class="column span-9 last">
Hycean Worlds, with masses between Earth and Neptune which have thin hydrogen rich atmospheres above a liquid water ocean may be very common in ou...
</div>
<p class="small">
Bought by
<a href="https://exchange.prx.org/station_accoun ... l">KTAL-LP [Las Cruces Community Radio]</a>,
<a href="https://exchange.prx.org/station_accoun ... ADIOLEX</a>,
<a href="https://exchange.prx.org/station_accoun ... dio">Raven Radio</a>,
<a href="https://exchange.prx.org/station_accoun ... p">KGLP</a>,
<a href="https://exchange.prx.org/station_accoun ... p">WTIP</a>
and more
</p>
</div>
<div class="column last piece_details">
<div class='jquery-stars-box' id='piece_495920-rating-box' style='width:200px'>
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
</div>
<br/>
<ul class="quiet">
<li>Added:
<em>Oct 29, 2023</em>
</li>
<li>Length:
<em>02:00</em>
</li>
<li>Purchases:
<em>9</em>
</li>
</ul>
</div>
</div>
<...>
I'm expecting an array of links. Instead, chromefindelements returns an array like this:
0: ARRELEMENTID_COUNT=20
0: ARRELEMENTID_1=6353AD95F3FE204955B5ECBCEB46484A_element_76
0: ARRELEMENTID_2=6353AD95F3FE204955B5ECBCEB46484A_element_77
0: ARRELEMENTID_3=6353AD95F3FE204955B5ECBCEB46484A_element_78
<...>
...and of course, nothing is clickable. I've checked the xpath with a couple of online evaluators and the //div[@class='title']/a returns a list of links as expected.
Any ideas?
I'm running:
ChromeFindElements>hIE,xpath,//div[@class='title']/a,arrElementID
ChromeElementAction>hIE,arrElementID_1,click
on the following. It's a long list, so only a snippet:
<...>
<div class="piece column span-16 even">
<div class="column span-11">
<div class="column span-11 last">
<div class="title">
<a href="/pieces/495920-770-hycean-worlds">770- Hycean Worlds</a>
<div class="subtitle">Are Sub-Neptune Planets an Abode of Life?
</div>
</div>
From:
<a href="/users/213240-travelersinthenight">Albert Grauer</a>
<br/>
Series:
<a href="https://exchange.prx.org/series/33698-t ... >Travelers In The Night</a>
<br/>
</div>
<div class="column span-2">
<a href="/pieces/495920-770-hycean-worlds"><img alt="Caption: This artist’s concept shows what exoplanet K2-18 b could look like based on science data., Credit: NASA, CSA, ESA, J. Olmsted (STScI), Science: N. Madhusudhan (Cambridge University)" src="https://s3.amazonaws.com/production.med ... square.png" style="float: left" version="square" width="75" /></a>
</div>
<div class="column span-9 last">
Hycean Worlds, with masses between Earth and Neptune which have thin hydrogen rich atmospheres above a liquid water ocean may be very common in ou...
</div>
<p class="small">
Bought by
<a href="https://exchange.prx.org/station_accoun ... l">KTAL-LP [Las Cruces Community Radio]</a>,
<a href="https://exchange.prx.org/station_accoun ... ADIOLEX</a>,
<a href="https://exchange.prx.org/station_accoun ... dio">Raven Radio</a>,
<a href="https://exchange.prx.org/station_accoun ... p">KGLP</a>,
<a href="https://exchange.prx.org/station_accoun ... p">WTIP</a>
and more
</p>
</div>
<div class="column last piece_details">
<div class='jquery-stars-box' id='piece_495920-rating-box' style='width:200px'>
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
<input name="piece_495920-rating" class="star {half:true}" type="radio" disabled="disabled" />
</div>
<br/>
<ul class="quiet">
<li>Added:
<em>Oct 29, 2023</em>
</li>
<li>Length:
<em>02:00</em>
</li>
<li>Purchases:
<em>9</em>
</li>
</ul>
</div>
</div>
<...>
I'm expecting an array of links. Instead, chromefindelements returns an array like this:
0: ARRELEMENTID_COUNT=20
0: ARRELEMENTID_1=6353AD95F3FE204955B5ECBCEB46484A_element_76
0: ARRELEMENTID_2=6353AD95F3FE204955B5ECBCEB46484A_element_77
0: ARRELEMENTID_3=6353AD95F3FE204955B5ECBCEB46484A_element_78
<...>
...and of course, nothing is clickable. I've checked the xpath with a couple of online evaluators and the //div[@class='title']/a returns a list of links as expected.
Any ideas?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1386
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: chromefindelements returning array of hexadecimal instead of links
ChromeFindElements always returns a list of element IDs like that. It's the subsequent commands (ChromeGetElementData, ChromeSetElementValue, ChromeElementAction) that extracts them.
If you look at ChromeFindElements you'll see you have a variety of methods available. One of these is "partial link text" (you could also use "link text")
So if you wanted to click on "Hycean" for example :
If you look at ChromeFindElements you'll see you have a variety of methods available. One of these is "partial link text" (you could also use "link text")
So if you wanted to click on "Hycean" for example :
Code: Select all
ChromeFindElements>hIE,partial link text,Hycean,arrElementID
ChromeElementAction>hIE,arrElementID_1,click
Yes, we have a Custom Scripting Service. Message me or go here
Re: chromefindelements returning array of hexadecimal instead of links
That helps, thanks.
The problem then seems to be that the ChromeElementAction>hIE,arrElementID_1,click is not performing a click action on the returned element.
The problem then seems to be that the ChromeElementAction>hIE,arrElementID_1,click is not performing a click action on the returned element.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1386
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: chromefindelements returning array of hexadecimal instead of links
Are you able to share the HTML for the specific link you're wishing to click please?
What is the value of arrElementID_count ?
What is the value of arrElementID_count ?
Yes, we have a Custom Scripting Service. Message me or go here
Re: chromefindelements returning array of hexadecimal instead of links
In the above code, this is the link I'm telling it to click:
<a href="/pieces/495920-770-hycean-worlds">770- Hycean Worlds</a>
It's a part of the div with the "title" class:
<div class="title">
<a href="/pieces/495920-770-hycean-worlds">770- Hycean Worlds</a>
<div class="subtitle">Are Sub-Neptune Planets an Abode of Life?
</div>
</div>
There is a list of 20 "title" divs on this page.
I'm using xpath //div[@class='title']/a in ChromeFindElements.
It comes up with 20 members in the array. I ask ChromeELementAction to click on element_1
Currently, the workaround is that I am using chromegetelementdata to collect the link itself from attribute/href and navigating to the link directly.
Also, tangential question on the same project:
Does ChromeElementAction "submit" choice operate on the page's 'form' element or the 'commit' button element?
<a href="/pieces/495920-770-hycean-worlds">770- Hycean Worlds</a>
It's a part of the div with the "title" class:
<div class="title">
<a href="/pieces/495920-770-hycean-worlds">770- Hycean Worlds</a>
<div class="subtitle">Are Sub-Neptune Planets an Abode of Life?
</div>
</div>
There is a list of 20 "title" divs on this page.
I'm using xpath //div[@class='title']/a in ChromeFindElements.
It comes up with 20 members in the array. I ask ChromeELementAction to click on element_1
Currently, the workaround is that I am using chromegetelementdata to collect the link itself from attribute/href and navigating to the link directly.
Also, tangential question on the same project:
Does ChromeElementAction "submit" choice operate on the page's 'form' element or the 'commit' button element?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1386
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: chromefindelements returning array of hexadecimal instead of links
I can't seem to replicate this at all. I've tried three different methods including yours, and they all successfully click the link. At the moment I am at a loss as to what could be causing you the problem, so I will consult Marcus.
In the meantime, it may be worth checking your ChromeDriver version matches your Chrome version - I don't think that's the issue but we should at least eliminate it - if all else is working as expected, it's not likely to be the culprit but it's the only other idea I have at the moment.
I've also asked him about the "submit" question, as that's dev-level knowledge.
In the meantime, it may be worth checking your ChromeDriver version matches your Chrome version - I don't think that's the issue but we should at least eliminate it - if all else is working as expected, it's not likely to be the culprit but it's the only other idea I have at the moment.
Code: Select all
//Partial link text
ChromeFindElements>hIE,partial link text,Hycean,arrElementID
let>zz=arrElementID_count
ChromeElementAction>hIE,arrElementID_1,click
//Xpath
ChromeFindElements>hIE,xpath,//div[@class='title']/a,arrElementID
let>zz=arrElementID_count
ChromeElementAction>hIE,arrElementID_1,click
//Find all hyperlinks
ChromeFindElements>hIE,tag name,a,arrElementID
let>zz=arrElementID_count
ChromeElementAction>hIE,arrElementID_1,click
Yes, we have a Custom Scripting Service. Message me or go here
- Dorian (MJT support)
- Automation Wizard
- Posts: 1386
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: chromefindelements returning array of hexadecimal instead of links
Re "submit". Submit submits a form. For buttons, use click.
Yes, we have a Custom Scripting Service. Message me or go here
Re: chromefindelements returning array of hexadecimal instead of links
Thank you Dorian,
I've checked (and re-downloaded) chromedriver, and it's current for the stable version of Chrome.
The click thing is weird, definitely. On some pages, "click" works without issue. On subsequent pages, it fails to click the element in array_1, even though the desired element is sitting right there in array_1, and the xpath is identical. I'd go back to simply tabbing into the desired button and pressing enter, but the webmasters opted to make the element not tabbable, and the corresponding result field is readonly.
I got the "submit" action working without any problems, so thanks for checking with Marcus.
I've checked (and re-downloaded) chromedriver, and it's current for the stable version of Chrome.
The click thing is weird, definitely. On some pages, "click" works without issue. On subsequent pages, it fails to click the element in array_1, even though the desired element is sitting right there in array_1, and the xpath is identical. I'd go back to simply tabbing into the desired button and pressing enter, but the webmasters opted to make the element not tabbable, and the corresponding result field is readonly.
I got the "submit" action working without any problems, so thanks for checking with Marcus.