Web surfing / browser automation

I am creating a Java program that goes on the Internet, subscribes to website accounts and messages. For instance. Run Program → Tumblr → Message "Helow World" → Exit Tumblr.

I'm currently using the Robot class to do this ... http://download.oracle.com/javase/6/docs/api/java/awt/Robot.html

But, looking to the future, I see a grandiose future (updates to web pages cause the program to crash, because they are based on coordinates, mouse clicks and keyboard.)

Is there a way to do web browser automation? (e.g. surfing websites, filling out forms, etc.) (preferably in Java, python, C ++ or php)

+5
source share
5 answers

Selenium is a great option for what you need. You can not only write scripts for it in java (like many other languages), but also install a plug-in for the browser, and also record your actions in order to quickly learn its syntax.

http://seleniumhq.org/

+8
source

Watij is a Java-based web testing platform that will manage your web browser. Although it is nominally for testing, it can do what you want. You can intelligently look for the button / controls to control, but because it controls the browser, all client-side functions (scripts, etc.) will start correctly.

+2
source

JExplorer Teamdev: Jexplorer. , . Internet Explorer. Watij JExplorer

+2

, , .

i used selenium in chrome. If you want to use selenium, you need to download the latest version from http://www.seleniumhq.org/download/ --- and implement it in neatbeans or eclipse jar files. (Binding Selenium Client and WebDriver, stand-alone Selenium server) After that, you need to download from google https://sites.google.com/a/chromium.org/chromedriver/ - chrome driver also download the latest version and save it on your computer. Here is the code I used:

package teszt;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Teszt {  
    public static void main(String[] args) {
String exePath = "C:\\Users\\Magor\\Downloads\\chromedriver.exe";
        System.setProperty("webdriver.chrome.driver", exePath);
        WebDriver driver = new ChromeDriver();
        driver.get("http://www.google.com");
}}
0
source

All Articles