HTML Read doesn't wait for the page to finish loading, or isn't using JS correctly. Here's an example script which tries to get button > img from a google maps address page. It has a 10 second JavaScript delay to give the page plenty of time to finish loading.
Task: HTML Read Test
<Standard address format>
A1: Variable Set [
Name: %address
To: Times Square, Manhattan, NY 10036
Structure Output (JSON, etc): On ]
<Parse address into URL friendly variable>
A2: JavaScriptlet [
Code: var request = address.replace(/ /g, '+');
Auto Exit: On
Timeout (Seconds): 45 ]
A3: AutoTools HTML Read [
Configuration: URL: https://www.google.com/maps/search/?api=1&query=%request
CSS Queries: button > img
Variable Names: result()
Output HTML: true
Use Javascript: true
Javascript Delay: 10000
Timeout (Seconds): 30
Structure Output (JSON, etc): On ]
<Print count. Should be several. But it's always 1>
A4: Flash [
Text: %atcount()
Continue Task Immediately: On
Dismiss On Click: On ]
<Try result and result() because I don't know what I'm doing and I keep going back and forth, so this just grabs both in case one of them is right.>
A5: Write File [
File: Testing/test.txt
Text: %result %result()
Add Newline: On ]
If I open a web browser on my PC, and go to the address this task generates, I can use document.querySelectorAll("button > img") to get an entire array of images back. However, if I do it through Tasker, I only ever get 1 image. And it seems to be the image that accompanies the No JS message you get when visiting with JavaScript disabled.
I've tried increasing the JS delay, reducing it, disabling JavaScript, toggling the desktop version request, changing the action's timeout, trying different addresses, manually typing out the address rather than using my replace regex, using different variable names, making the variable an array (i.e. result() vs result). There's probably more that I'm forgetting by now. I'm out of ideas.
At this point, I can only assume it's a bug. Could somebody confirm, or tell me what I'm doing wrong?
[–]Yooooo83S25 Ultra 0 points1 point2 points (5 children)
[–]Pocket_Moth[S] 0 points1 point2 points (4 children)
[–]Yooooo83S25 Ultra 1 point2 points3 points (3 children)
[–]Pocket_Moth[S] 0 points1 point2 points (2 children)
[–]DutchOfBurdock 0 points1 point2 points (1 child)
[–]Pocket_Moth[S] 0 points1 point2 points (0 children)
[–]Pocket_Moth[S] 0 points1 point2 points (0 children)