Last active
July 23, 2023 16:15
-
-
Save Corefinder89/1310837621416b39d9152a8fabaf7b32 to your computer and use it in GitHub Desktop.
SF-Poc code using selenium in chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebDriverWait wait = new WebDriverWait(driver, 10); | |
WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(""))); | |
package to be imported | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.support.ui.ExpectedConditions; | |
import org.openqa.selenium.support.ui.WebDriverWait; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testSelenium; | |
import java.util.concurrent.TimeUnit; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.testng.annotations.AfterTest; | |
import org.testng.annotations.BeforeTest; | |
import org.testng.annotations.Test; | |
public class SFPoc | |
{ | |
public WebDriver driver; | |
@BeforeTest | |
public void configureBrowser() | |
{ | |
System.setProperty("webdriver.chrome.driver","chromedriver"); | |
driver = new ChromeDriver(); | |
System.out.println("\n>>>Web Driver initiated"); | |
driver.manage().window().maximize(); | |
System.out.println("\n>>>Window maximized"); | |
driver.get("https://salesdemo.successfactors.eu/login?company=SFPART013489#/login"); | |
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); | |
} | |
@Test | |
public void testLogin() throws InterruptedException | |
{ | |
driver.findElement(By.cssSelector("#__input1-inner")).sendKeys("test123"); | |
System.out.println("\n>>>Entered username"); | |
Thread.sleep(3); | |
driver.findElement(By.cssSelector("#__input2-inner")).sendKeys("test123"); | |
System.out.println("\n>>>Entered password"); | |
Thread.sleep(3); | |
driver.findElement(By.cssSelector("#__button2-content")).click(); | |
System.out.println("\n>>>Clicked on button"); | |
Thread.sleep(5); | |
} | |
@AfterTest | |
public void tearDown() | |
{ | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment