Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package googlePackage;
- import java.awt.*;
- import javax.swing.*;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.htmlunit.HtmlUnitDriver;
- public class GoogleClass extends JFrame {
- static final long serialVersionUID = 1L;
- JLabel title = new JLabel("");
- JPanel pane = new JPanel();
- JButton submit = new JButton("");
- JTextArea output = new JTextArea(10,80);
- GoogleClass(){
- super("Google"); setBounds(200,100,900,300);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Container con = this.getContentPane();
- con.add(pane);
- WebDriver driver = new HtmlUnitDriver();
- driver.get("http://www.google.com");
- //WebElement element = driver.findElement(By.name())
- title.setText(driver.getTitle());
- output.setText("Output:");
- output.setSize(100, 100);
- submit.setText("submit");
- pane.add(title);
- pane.add(output);
- pane.add(submit);
- setVisible(true);
- }
- public static void main(String[] args){
- new GoogleClass();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement