Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.patryk;
- import java.util.concurrent.TimeUnit;
- import org.openqa.selenium.By;
- import org.openqa.selenium.By.ByTagName;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import org.openqa.selenium.support.ui.WebDriverWait;
- public class Bot {
- public static void main(String[] args) {
- WebDriver driver = new ChromeDriver();
- driver.get("https://lobby.ikariam.gameforge.com/pl_PL/");
- new WebDriverWait(driver, 1);
- WebElement elementEmail = driver.findElement(By.name("email"));
- WebElement element2 = driver.findElement(By.name("password"));
- elementEmail.sendKeys("@gmail.com");
- element2.sendKeys("password");
- driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
- element2.submit();
- driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
- WebElement element3 = driver.findElement(By.name("password"));
- element3.submit();
- System.out.println("Page title is: " + driver.getTitle());
- // Google's search is rendered dynamically with JavaScript.
- // Wait for the page to load, timeout after 10 seconds
- /*
- * (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
- * public Boolean apply(WebDriver d) { return
- * d.getTitle().toLowerCase().startsWith("cheese!"); } });
- */
- // Should see: "cheese! - Google Search"
- System.out.println("Page title is: " + driver.getTitle());
- // driver.quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement