I am trying to automate to log in into salesforce account and after it logs in i want it to click on contact button but for some reason it wont, i even wrote a different function just for it to click it but after it logs in it freezes in the same page after the screen maximizes.
And this is my code: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver;
public class browser {
public static void main(String[] args) throws InterruptedException {
System.out.println("Start Test Case");
initialize();
LoginSFDC();
WrongUNandPW();
}
private static WebDriver driver = null;
public static void initialize() {
System.setProperty("webdriver.chrome.driver", "chromedriver");
driver = new ChromeDriver();
}
public static void LoginSFDC() throws InterruptedException {
driver.get("https://login.salesforce.com/");
driver.findElement(By.xpath("//input[@id='username']")).sendKeys("arnish.chakma-fliw@force.com");
driver.findElement(By.xpath("//input[@id='password']")).sendKeys("lolboy845JJ");
driver.findElement(By.xpath("//input[@id='rememberUn']")).click();
driver.findElement(By.xpath("//input[@id='Login']")).click();
driver.manage().window().maximize();
WebElement contactbtn = driver.findElement(By.xpath("//a[@id='trial-subscribe-now']"));
contactbtn.click();
driver.close();
}
public static void WrongUNandPW() throws InterruptedException {
driver.get("https://login.salesforce.com/");
driver.findElement(By.xpath("//input[@id='username']")).sendKeys("arnish.chakma-fliw@force123.com");
driver.findElement(By.xpath("//input[@id='password']")).sendKeys("lolboy845JJ123");
driver.findElement(By.xpath("//input[@id='rememberUn']")).click();
driver.findElement(By.xpath("//input[@id='Login']")).click();
Thread.sleep(2000);
}
}
Can someone help me find a solution for this thank you.