Given that a local copy of the Selenium server and web drivers are required to run an automation test, i.e...

  • junit-4.10.jar
  • selenium-chrome-driver-2.0a4.jar
  • selenium-java-2.53.0-srcs.jar
  • selenium-java-2.53.0.jar
  • selenium-server-standalone-2.53.0.jar

Is there any way to run a web service where, for example, when the user clicks a button a Selenium script will execute for them? For example, a bot that automates tweets, i.e. https://github.com/santafebound/twitter-story-teller, without actually referencing the Twitter oAuth API because the automation is done locally on the user's machine, i.e. opens a browsers, inputs auth information, and tweets using mouse clicks and keyboard events? This was just a concrete example, but the question applies equally to any other conceivable type of Selenium automation test.

Are there any inherent limitations to this method? Seems kind of dangerous to me so I'm thinking maybe browsers somehow block this kind of thing from functioning?


There are no limitations that do not apply to selenium itself

There is nothing that prevents you from driving selenium based on a call to a webservice. It is not hard to implement some code that will do exactly what you want by running Selenium. Services such as Twitter usually limit this behavior by using various techniques such as throtteling (limiting the amount of requests you can make), or force you to log in by only allowing authentication using a CAPTCHA which you can obviously not parse with Selenium.

In fact, if you really want to there is no need for Selenium whatsoever as you could send the HTTP requests as POST and GET directly to the server (effectively implementing your own 'browser' without the UI). Some of the best programming fun I had years ago was building a bot to play a certain browser-based game by simply sending POST and GET requests directly and parsing the HTML to determine appropriate responses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.