Advertisement
andydraysen

Untitled

May 3rd, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. package googlePackage;
  2.  
  3. import java.awt.*;
  4. import javax.swing.*;
  5.  
  6. import org.openqa.selenium.By;
  7. import org.openqa.selenium.WebDriver;
  8. import org.openqa.selenium.WebElement;
  9. import org.openqa.selenium.htmlunit.HtmlUnitDriver;
  10.  
  11. public class GoogleClass extends JFrame {
  12. static final long serialVersionUID = 1L;
  13.  
  14. JLabel title = new JLabel("");
  15. JPanel pane = new JPanel();
  16. JButton submit = new JButton("");
  17. JTextArea output = new JTextArea(10,80);
  18.  
  19. GoogleClass(){
  20. super("Google"); setBounds(200,100,900,300);
  21. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  22. Container con = this.getContentPane();
  23. con.add(pane);
  24.  
  25. WebDriver driver = new HtmlUnitDriver();
  26. driver.get("http://www.google.com");
  27. //WebElement element = driver.findElement(By.name())
  28.  
  29.  
  30. title.setText(driver.getTitle());
  31. output.setText("Output:");
  32. output.setSize(100, 100);
  33. submit.setText("submit");
  34.  
  35. pane.add(title);
  36. pane.add(output);
  37. pane.add(submit);
  38. setVisible(true);
  39. }
  40. public static void main(String[] args){
  41. new GoogleClass();
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement