Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search then Click on Element
#3
Maddire,

Figured to have another look at this and saw my mistake...

The code:
Code:
var downloadButton;
downloadButton = document.getElementsByClassName("mega-button positive js-default-download js-standard-download");
does not just return a html element, instead it returns a HTMLCollection array... an array with 1 element.
So my mistake was to try and send "click" from the array instead of the html element.

Just tested it and this code works fine:
Code:
var downloadButton;
downloadButton = document.getElementsByClassName("mega-button positive js-default-download js-standard-download");
downloadButton[0].click();

Obviously it could use some error checking, but the principle works fine.
It triggers a download just like you are after.

--
Wil
Reply


Messages In This Thread
Search then Click on Element - by maddire - 2024-01-07, 21:45:24
RE: Search then Click on Element - by wila - 2024-01-08, 11:50:39
RE: Search then Click on Element - by wila - 2024-01-09, 14:33:46

Forum Jump:


Users browsing this thread: 2 Guest(s)