Facebook
From Valentin, 2 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 198
  1. public static void main(String[] args) throws FileNotFoundException, InterruptedException {
  2.         WebDriver driver = new ChromeDriver();
  3.         driver.get("https://www.nytimes.com/games/wordle/index.html");
  4.  
  5.         try {
  6.             WebElement closeButton = driver.findElement(By.id("pz-gdpr-btn-closex"));
  7.             closeButton.click();
  8.         }
  9.         catch (NoSuchElementException e) {
  10.         System.out.println("Close button not found: " + e.getMessage());
  11.         }
  12.         try {
  13.             WebElement secondCloseButton= driver.findElement(By.className("game-icon"));
  14.             secondCloseButton.click();
  15.         }
  16.         catch (NoSuchElementException e) {
  17.             System.out.println("Close button not found: " + e.getMessage());
  18.         }
  19.         TimeUnit.MICROSECONDS.sleep(200000);
  20.  
  21.  
  22.         Actions actions = new Actions(driver);
  23.         actions.sendKeys("house").sendKeys(Keys.ENTER).perform();
  24.         // Close the driver
  25.         TimeUnit.SECONDS.sleep(10);
  26.         driver.quit();
  27.     }