Did you try using chrome browser?
Additionally, i noticed that firefox is showing up a alert box.
To handle that you need to use the below code.
[code:20kpv19m]WebDriverWait explicitWait = new WebDriverWait(driver, 5);
explicitWait.until(ExpectedConditions.alertIsPresent());
Alert alertingHandler = driver.switchTo().alert();
alertingHandler.accept();
driver.switchTo().defaultContent();[/code:20kpv19m]
This code absolutely works fine
[code:3h4xon1i]import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class RediffPortfolio {
public static void main(String[] args) throws Exception {
WebDriver driver = new FirefoxDriver();
/************************* Chrome Browser *******************************/
// WebDriver driver = new ChromeDriver();
/************************* Common Code ***********************************/
driver.get("https://portfolio.rediff.com/portfolio");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Logging in
driver.findElement(By.cssSelector("#useremail")).sendKeys("xxxxx");
driver.findElement(By.cssSelector("#emailsubmit")).click();
driver.findElement(By.cssSelector("#userpass")).sendKeys("xxxxx");
driver.findElement(By.cssSelector("#loginsubmit")).click();
/* Specific to FireFox only. */
WebDriverWait explicitWait = new WebDriverWait(driver, 5);
explicitWait.until(ExpectedConditions.alertIsPresent());
Alert al = driver.switchTo().alert();
al.accept();
driver.switchTo().defaultContent();
// Creating PortFolio
Thread.sleep(5000);
driver.findElement(By.xpath("//*[@id='createPortfolio']")).click();
driver.findElement(By.cssSelector("#create")).sendKeys("newDummyPortfolio");
driver.findElement(By.cssSelector("#createPortfolioButton")).click();
}
}[/code:3h4xon1i]
Instead of alert you can also wait for page to load
In module 17, we have taken this as an exercise