Skip to content

Instantly share code, notes, and snippets.

@rustyhaidu
Created April 12, 2024 14:55
Show Gist options
  • Save rustyhaidu/c4b306c2a40ea0470ad960cd3e7c5d0b to your computer and use it in GitHub Desktop.
Save rustyhaidu/c4b306c2a40ea0470ad960cd3e7c5d0b to your computer and use it in GitHub Desktop.
@Test
public void test1() throws InterruptedException {
Thread.sleep(5000);
WebElement iframe = driver.findElement(By.cssSelector("iframe[id*='google_ads_iframe']"));
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].style.display='none'", iframe);
driver.findElement(By.cssSelector("#firstName")).sendKeys("Vlad");
driver.findElement(By.cssSelector("#lastName")).sendKeys("Muresan");
driver.findElement(By.cssSelector("#userEmail")).sendKeys("[email protected]");
jsExecutor.executeScript("window.scrollTo(0, document.body.scrollHeight)");
driver.findElement(By.xpath("//label[@for='gender-radio-1']")).click();
driver.findElement(By.cssSelector("#userNumber")).sendKeys("0123456789");
driver.findElement(By.cssSelector("#dateOfBirthInput")).click();
driver.findElement(By.cssSelector(".react-datepicker__month-select")).click();
driver.findElement(By.cssSelector("option[value='5']")).click();
driver.findElement(By.cssSelector(".react-datepicker__year-select")).click();
driver.findElement(By.cssSelector("option[value='2002']")).click();
driver.findElement(By.cssSelector("div[aria-label='Choose Wednesday, June 5th, 2002']")).click();
/* Aici am avut ceva probleme in a intelege cum sa folosesc campul cu auto-complete.
driver.findElement(By.cssSelector(".subjects-auto-complete__value-container.subjects-auto-complete__value-container--is-multi.css-1hwfws3")).sendKeys("com");
List<WebElement> autoCompleteOptions = driver.findElements(By.class("subjects-auto-complete__indicators css-1wy0on6")); */
//driver.findElement(By.xpath("//label[@for='hobbies-checkbox-1']")).click();
//driver.findElement(By.xpath("//label[@for='hobbies-checkbox-3']")).click();
driver.findElement(By.cssSelector("#currentAddress")).sendKeys("Calea Lui Traian nr. 264");
/* Si aici la droppable case am incercat ceva dar nu am reusit.
driver.findElement(By.cssSelector(".css-1uccc91-singleValue")).click();
driver.findElement(By.linkText("Haryana")).click(); */
WebElement element = driver.findElement(By.id("submit"));
element.click();
WebElement success = driver.findElement(By.id("example-modal-sizes-title-lg"));
String validFormSubmited = success.getText().trim();
Assert.assertEquals(validFormSubmited, "Thanks for submitting the form");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment