0

I need to make a google chrome extension that would click one specific link. The problem is that it can only be accessed by clicking the button on the page and choosing it in the drop-down menu. I tried using document.getElementsByTagName('a'), but it collects all links except for the ones from the drop-down menu. Can anybody help me with that?

  • 1
    Those links are probably generated by that button's click handler so you can send a `click` event using your content script, [example](https://stackoverflow.com/a/27761213). Then the links will either appear immediately or you'll need to use MutationObserver or a simple setTimeout. – wOxxOm Jul 28 '20 at 06:20
  • @wOxxOm, thanks! I tried it, but the links still don't show up. Though I made sure that the click event is working. But thanks for the idea! – Aleksandra Lee Jul 28 '20 at 18:28
  • Check which mouse event is actually used by the element in devtools -> `Event listeners` panel. It may be `mousedown` or some other variety. – wOxxOm Jul 29 '20 at 05:13
  • @wOxxOm, I've just looked it up, it is a "clicked" event. The links seem to be somehow hidden, but I can't understand how to retrieve them – Aleksandra Lee Jul 29 '20 at 06:02
  • Can't help without seeing the page. Try adding [MCVE](/help/mcve) to the question or at least make an excerpt of the page on jsfiddle and link it here. – wOxxOm Jul 29 '20 at 06:25

0 Answers0