Friday 20 July 2018

I can't click on that link that has no href attribute

I am making a bot that locates a page and automatically finds an "href" like so <a class="batteekh"></a> what I want is just to click this hyperlink in any way I can.

After selecting my hyperlink $(".batteekh").attr("style","background-color:red") I changed the background-color to red and it works but what is happening is that I can't click on that link that has no href attribute.

I've searched a lot and tried several statements but none works:

  • $(".batteekh").trigger("click");
  • $(".batteekh").click()
  • $(".batteekh").get(0).click()

Thanks in advance!

I am trying to auto vote up a question in stackoverlow

EDIT:

// ==UserScript==
// @name         Stackoverflow Voter
// @namespace    http://tampermonkey.net/
// @version      0.1
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @description  try to take over the world!
// @author       You
// @match        https://stackoverflow.com/questions/*
// @grant        none
// ==/UserScript==

$(".vote-up-off").attr("style","background-color:red")[0].click();

NOTE : I am using this for learning purpose only



from I can't click on that link that has no href attribute

No comments:

Post a Comment