SHARE
TWEET

Untitled

a guest Oct 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package cz.cvut.fel.still.sqa.page_objects;
  2.  
  3. import com.lazerycode.selenium.util.Query;
  4. import org.openqa.selenium.By;
  5. import org.openqa.selenium.WebDriver;
  6. import org.openqa.selenium.remote.RemoteWebDriver;
  7.  
  8. import java.net.MalformedURLException;
  9.  
  10. public class GoogleHomePage extends BasePage {
  11.  
  12.     private Query searchBar = new Query(By.name("q"), driver);
  13.     private Query googleSearch = new Query(By.name("btnK"), driver);
  14.     private Query imFeelingLucky = new Query(By.name("btnI"), driver);
  15.  
  16.     public GoogleHomePage(RemoteWebDriver driver) throws MalformedURLException {
  17.         super(driver);
  18.     }
  19.  
  20.     public static GoogleHomePage goTo(String baseUrl, RemoteWebDriver driver) throws MalformedURLException {
  21.         driver.get(baseUrl);
  22.         GoogleHomePage googleHomePage = new GoogleHomePage(driver);
  23.         return googleHomePage;
  24.     }
  25.  
  26.     public GoogleHomePage enterSearchTerm(String searchTerm) {
  27.         searchBar.findWebElement().clear();
  28.         searchBar.findWebElement().sendKeys(searchTerm);
  29.  
  30.         return this;
  31.     }
  32.  
  33.     public GoogleHomePage submitSearch() {
  34.         googleSearch.findWebElement().submit();
  35.  
  36.         return this;
  37.     }
  38.  
  39.     public void getLucky() {
  40.         imFeelingLucky.findWebElement().click();
  41.     }
  42.  
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top