Này người xa lạ!

Còn chờ gì nữa mà không mau đăng nhập hoặc đăng ký để cùng tham gia thảo luận với cộng đồng!

Need help with one script and document.querySelector

I'm trying to make a simple script that would click on the "Starred" button automatically on https://tvlistings.zap2it.com to have automatically the starred channel without the need to click manually the button since the dafault is "All Channels".

I tried many methods but all seem to fail and I don't understand why ?

Here's the last script I've tried:

_// ==UserScript==
// @name Zap2it Starred on open
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://tvlistings.zap2it.com/*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==



}, 25000);


I've put the setTimeout to let the page load before clicking on the button but it don't work.

The problem must be obvious but sadly I don't see what is wrong and why it don't work ??? :no_mouth:

Bình luận

  • you should click the a element in grid but not the grid itself,blow selector may work

  • Thanks a lot it work now :smiley:

    Could you explain me why it did not work when I use only the "'.grid-filter-controls__starred" class ?

    Also where I can learn more about the syntax of putting element with ">" sign ?

    Thanks again for the help ! 👍

  • đã sửa December 2018 Chrome

    because only the <a> element inside "'.grid-filter-controls__starred" class element have click event listener witch can response your click in this page,usually you can see if element have event listeners in browser's element inspector ,the <a> element means a link that often can be click. want to know more about selector you can google about CSS selectors ,the ">" sign means Child combinator, .grid-filter-controls__starred>a means the <a> type element inside ".grid-filter-controls__starred" element

  • Thanks a lot for your explanation 👍☺️

Đăng nhập hoặc Đăng ký để gửi bình luận.