I make a bot for one site on JS. I load my JS file through a bookmark in the browser, there is such a method.

I use Google Chrome browser, I try using jQuery to click on the button on this site, but for some reason it does not work.

Not advertising for the sake of course, the site itself is here: alpari [dot] en / ru / binary_options /

You need to click on the "ВЫШЕ" button. Tried in two ways:

 $("div.bali-grid__call_put button.bali-button_type_green").trigger("click"); 

 var event = $.Event('click'); event.clientX = 1010; event.clientY = 805; $('div.bali-grid__call_put button.bali-button_type_green').trigger(event); 

But the click does not occur. Perhaps as a ban on a software click was made, but I still do not understand how.

    1 answer 1

    Try a simple click:

      $("div.bali-grid__call_put button.bali-button_type_green")[0].click(); 

    trigger ("click") - not suitable for clicking on a link, it triggers an event. You can also look towards the location capabilities.

      var your_url = $("a").attr("href"); location = your_url; 
    • It seems there is no need for an index, otherwise there will be a native element - A. Gusev
    • a click without an index will return the element object to the console, and redirection will work with the index. Something like this: pixs.ru/showimage/testjpg_8978109_24435982.jpg - simplehtmlcoder
    • What redirection? It returns a jquery object, and also raises an event. - A. Gusev
    • jsfiddle.net/f0k3gchv - like this clearly - simplehtmlcoder
    • one
      It has nothing to do with jQuery. Here is the fixed example - jsfiddle.net/f0k3gchv/1 . To emulate a click on a link, a click event is raised on the child. Or, use the native click () method, which will do everything itself. - A. Gusev