添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
  • Contact Us (current)
  • All Courses (current)
  • [b:1zga3ia3]I am struggling for last two days click on 'Create Portfolio' button which opens Dialog Box. [/b:1zga3ia3]

    [b:1zga3ia3]screenshots are provided[/b:1zga3ia3]

    Please help me to find out correct approach, i can't move ahead by skipping this.

    [b:1zga3ia3] I have tried multiple approach but it doesn't worked[/b:1zga3ia3]

    1 WebElement button =driver.findElement(By.xpath("//div[@class='lft']/ul/li[3]/a"));
    Point location = button.getLocation();
    Actions act = new Actions(driver);
    int x= location.getX();
    int y=location.getY();
    act.moveToElement(button,x,y).click().build().perform();

    2 JavascriptExecutor js = (JavascriptExecutor)driver;
    WebElement button =driver.findElement(By.xpath("/html/body/div[3]/div[2]/div/div[1]/div/div[4]/div[2]/ul[@class='editPort']/li[3]/a/img[@title='Create']"));
    js.executeScript("arguments[0].click();", button);

    3 WebDriverWait wait1 =new WebDriverWait(driver, 30);
    wait1.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//ul[@class='editPort']/li[3]/a"))));
    driver.findElement(By.xpath("//ul[@class='editPort']/li[3]/a")).click();


    above any approach gives below error
    org.openqa.selenium.NoAlertPresentException: No modal dialog is currently open 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]

    We offer online selenium and UFT/QTP training. The course is very comprehensive and covers every aspect of automation testing with UFT/QTP and selenium. All types of frameworks are covered in depth - data driven framework, hybrid framework, page object model with a live project

  • Selenium - Course Details
  • QTP/UFT - Course Details
  • Appium - Course Details
  • © 2020 Whizdom Trainings. All rights Reserved - Powered by Whizdom Trainings