Untitled
unknown
plain_text
2 years ago
2.1 kB
12
Indexable
package saucedemo.pageobject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class pomsaucedemo
{
WebDriver rdriver;
pomsaucedemo(WebDriver ldriver)
{
rdriver=ldriver;
PageFactory.initElements(ldriver,this );
}
@FindBy(id="user-name")
WebElement userids;
@FindBy(id="password")
WebElement pwd;
@FindBy(id="login-button")
WebElement clickbutton;
@FindBy(className ="bm-burger-button")
WebElement menubar;
@FindBy(id = "about_sidebar_link")
WebElement aboutmenu;
@FindBy(xpath = "//div[text()='Sauce Labs Fleece Jacket']/following::button[1]")
WebElement clickAddtokart;
@FindBy(xpath = "//a[@class=\"shopping_cart_link\"]")
WebElement clickaddtokart;
@FindBy(id = "checkout")
WebElement clickcheakout;
@FindBy(id = "first-name")
WebElement testfirstname;
@FindBy(id ="last-name")
WebElement testlastname;
@FindBy(id = "postal-code")
WebElement testzipcode;
@FindBy(id = "continue")
WebElement clickcontinue;
@FindBy(xpath ="//div[text()='Sauce Labs Fleece Jacket']")
public WebElement jacketproduct;
public void setusername(String uname)
{
userids.sendKeys(uname);
}
public void setpassword(String password)
{
pwd.sendKeys(password);
}
public void setclickbutton()
{
clickbutton.click();
}
public void setmenu()
{
menubar.click();
}
public void setabout()
{
aboutmenu.click();
}
public void setaddtokart()
{
clickAddtokart.click();
}
public void setclicktokart()
{
clickaddtokart.click();
}
public void setclickcheckout()
{
clickcheakout.click();
}
public void setfirstname(String fname)
{
testfirstname.sendKeys(fname);
}
public void setlastname(String lname)
{
testlastname.sendKeys(lname);
}
public void setzipcode(String zname)
{
testzipcode.sendKeys(zname);
}
public void setclick()
{
clickcontinue.click();
}
}
Editor is loading...
Leave a Comment