1

I am using Selenium webDriver with page object design pattern. I want to automate this scenario. Here is the screenshot, tells about a sharing document. In the username field when I enter a name it will automatically displays in the list and I want to do double click the displayed name. but how ? Here is the screenshot for send document module.enter image description here

package Pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;

public class ShareDocument
{

    @FindBy(linkText="App")
    WebElement app;
    @FindBy(linkText="Documents")
    WebElement documents;
    @FindBy(xpath="//*[@id='list-container']/ul/li[3]/span[8]/a[2]/i")
    WebElement share;
    @FindBy(id="browseUsersEmail")
    WebElement perm;
    @FindBy(xpath="//*[@id='24@user']/span[1]")

    WebElement name_dropdown;
    @FindBy(id="other_notes")
    WebElement msg;
    @FindBy(className="btn-primary")
    WebElement button;
    //constructor
    public ShareDocument(WebDriver driver)
    {
        PageFactory.initElements(driver, this);
    }
    public void setApp()
    {
        app.click();
    }
    public void setDocument()
    {
        documents.click();
    }
    public void setShare()
    {
        share.click();
    }
    public void setPerm(String per)
    {
        perm.clear();
        perm.sendKeys(per);
    }
    public void select_List(String Name)
    {
        Select namedropdown=new Select(name_dropdown);
        namedropdown.selectByVisibleText(Name);
    }
    public void setMesg(String me)
    {
        msg.clear();
        msg.sendKeys(me);
    }
    public void setButton()
    {
        button.submit();
    }
}


package Test;
import org.testng.annotations.Test;

import Pages.ShareDocument;
import Pages.LoginPage;
import org.testng.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;

public class ShareDocTest 
{
    WebDriver driver;
@BeforeTest
public void setup()
{
    System.setProperty("webdriver.firefox.marionette","pathToGeckodriver");
    driver=new FirefoxDriver();
    driver.manage().window().maximize();
    driver.get("http://54.68.159.204/docmgr");
}
@Test(priority=1)
public void verify1()
{
    LoginPage login=new LoginPage(driver);
    login.set_username("docmanager");
    login.set_password("1");
    login.click_button();
    Assert.assertTrue(driver.getPageSource().contains("Hello Administrator"));
}
@Test(priority=2)
public void verify2()
{
    ShareDocument doc=new ShareDocument(driver);
    doc.setApp();
    doc.setDocument();
    doc.setShare();
    doc.setPerm("huggins");
    doc.select_List("huggins");
    doc.setMesg("Selenium notes");
    doc.setButton();
    Assert.assertTrue(driver.getPageSource().contains("Hello Administrator"));

}
}
0

Oh Its due to auto-completion - Its not really needed to double click

Solution:

  • You can turn OFF those settings from browser settings to not save credentials
  • hai I couldn't understand please clarify me. When I enter a name or first character it will automatically display the name and I need to double the name then only it will select. – user21268 Nov 9 '16 at 3:56
  • Your issue has been resolved? – NarendraC Nov 9 '16 at 4:13
  • I'm in stuck please help me. – user21268 Nov 10 '16 at 7:13
  • Where you got stuck Antony? – NarendraC Nov 10 '16 at 8:58
  • I could'nt able to automate this page. in manully, when I type a name in the username feild it automatically displays in the list and I need to double click that list then only it will select. how to automate this ? I'm in stuck – user21268 Nov 10 '16 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy