Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
.click() method not recognised

Right now i'm playing around with creating yet another version of a bot for one of my favorit browser games Big Barn World. I try to use .click() on an Element to water a crop which just won't work. I tried adding an EventListener to the node i'm using .click() on. That works fine but the Website itself does not react to that. In previous versions i used http requests or mouse automation, both being slow and inconsistent. I'm looking for a different approach to "click" the buttons on the Webpage. I would already be happy if you could tell me what might be stopping .click() from working so i can do further research. I'm using C#/JS with EO.WebBrowser.

This is the JS code i'm running.

document.getElementById('s_0_0').click();

I tried this in chrome dev console and clicked the button manually. If i click manually everything works fine. As said the EventListener recognises my .click()-call but the website itself just won't do anything. Dev Console Returns "undefined".

The Element i'm trying to click.

<div class="sector s_0_0" id="s_0_0" style="background-image: url(&quot;https://static.airg.ca/games/bbw/fieldplot/200/200/png&quot;); width: 20%; padding-bottom: 20%;">
    <div class="overlay itemImage " style="background-image: url(https://static.airg.ca/games/bbw/WheatSeeds_seeded/200/200/png)"></div>           
    <div class="overlay status water" style="background-image: url(&quot;https://static.airg.ca/bbw5/img/status_water.png&quot;);"></div>
</div>

EDIT: from what i've read the problem might be the click() method being isTrusted = false;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You seem to be mixing two different issues. The first is about the method being recognized.

When you have a browser console interaction like

> document.getElementById('...').click()
< undefined

the click method was recognized, it just produced no return value. You can check the behavior of calling something unrecognized

> (0).click();
x Uncaught TypeError: 0.click is not a function at <anonymous>:1:5

Now the second issue, is about the method doing nothing. Event handling in web pages can be done in many different ways. What does click() do? Perhaps it sends a mouseclick event, but the app in question might be listening for a mousedown event (triggered as soon as the button is pressed, without waiting for its release). You can search your browser's Developer Tools documentation to know how to check event listeners for an element and figure out the appropriate one you should be triggering. Simulating something like a mousedown event is a lot more complex than just calling click() but it's doable. You can check the MDN documentation for MouseEvent and search for the example of how to create a synthetic click mouse event.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!