Check Out Page Class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package pageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import utility.Log;
public class CheckOut_Page extends BaseClass{ private static WebElement element; public static String sProductName; public static String sProductPrice; public CheckOut_Page(WebDriver driver){ super(driver); } public static WebElement txt_ProductPrice(){ element = null; try{ element= driver.findElement(By.xpath(""+ ".//*[@id='checkout_page_container']/div[1]/table/tbody/tr[2]/td[4]")); Log.info("Product Price for purchased product is found on the Check Out Page"); }catch (Exception e){ Log.error("Price for purchased product on Check Out page is not found"); throw(e); } return element; } public static WebElement txt_ProductName(){ element = null; try{ element= driver.findElement(By.xpath(""+ ".//*[@id='checkout_page_container']/div[1]/table/tbody/tr[2]/td[2]/a")); Log.info("Product Name for purchased product is found on the Check Out Page"); }catch (Exception e){ Log.error("Price for purchased product on Check Out page is not found"); throw(e); } return element; } public static WebElement btn_Continue(){ element = null; try{ element= driver.findElement(By.xpath(""+ ".//*[@id='checkout_page_container']/div[1]/a/span")); Log.info("Continue button is found on the Check Out Page"); }catch (Exception e){ Log.error("Continue button on Check Out page is not found"); throw(e); } return element; } } |
Payment Details Page Class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
package pageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import utility.Log;
public class PaymentDetails_Page extends BaseClass {
private static WebElement element;
public PaymentDetails_Page(WebDriver driver){
super(driver);
}
public static WebElement txt_Email(){
element = null;
try{
element= driver.findElement(By.id("wpsc_checkout_form_9"));
Log.info("Email text box on Payment Details page is found.");
}catch (Exception e){
Log.error("Email text box on Payment Details page is not found");
throw(e);
}
return element;
}
public static WebElement txt_FirstName(){
element = null;
try{
element= driver.findElement(By.id("wpsc_checkout_form_2"));
Log.info("First Name text box on Payment Details page is found.");
}catch (Exception e){
Log.error("First Name text box on Payment Details page is not found");
throw(e);
}
return element;
}
public static WebElement txt_LastName(){
element = null;
try{
element= driver.findElement(By.id("wpsc_checkout_form_3"));
Log.info("Last Name text box on Payment Details page is found.");
}catch (Exception e){
Log.error("Last Name text box on Payment Details page is not found");
throw(e);
}
return element;
}
public static WebElement txt_Address(){
element = null;
try{
element= driver.findElement(By.id("wpsc_checkout_form_4"));
Log.info("Address text box on Payment Details page is found.");
}catch (Exception e){
Log.error("Address text box on Payment Details page is not found");
throw(e);
}
return element;
}
public static WebElement txt_City(){
element = null;
try{
element= driver.findElement(By.id("wpsc_checkout_form_5"));
Log.info("City text box on Payment Details page is found.");
}catch (Exception e){
Log.error("City text box on Payment Details page is not found");
throw(e);
}
return element;
}
public static void drpdwn_Country(String sCountry){
element = null;
try{
Select element= new Select(driver.findElement(By.id("wpsc_checkout_form_7")));
Log.info("Country dropdown on Payment Details page is found.");
element.selectByVisibleText(sCountry);
}catch (Exception e){
Log.error("Country dropdown on Payment Details page is not found");
throw(e);
}
}
public static WebElement txt_Phone(){
element = null;
try{
element= driver.findElement(By.id("wpsc_checkout_form_18"));
Log.info("Phone text box on Payment Details page is found.");
}catch (Exception e){
Log.error("Phone text box on Payment Details page is not found");
throw(e);
}
return element;
}
public static WebElement chkbx_SameAsBillingAdd(){
element = null;
try{
element= driver.findElement(By.id("shippingSameBilling"));
Log.info("Same as Billing address check box on Payment Details page is found.");
}catch (Exception e){
Log.error("Same as Billing address check box"+
" on Payment Details page is not found"); throw(e); } return element; } public static WebElement btn_Purchase(){ element = null; try{ element= driver.findElement(By.xpath(""+ ".//*[@id='wpsc_shopping_cart_container']/form/div[4]/div/div/span/input")); Log.info("Purchase button on Payment Details page is found."); }catch (Exception e){ Log.error("Purchase button on Personal Details page is not found"); throw(e); } return element; } } |
Confirmation Page Class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package pageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import utility.Log;
public class Confirmation_Page extends BaseClass{
private static WebElement element = null;
public static String sProductName;
public static String sProductPrice;
public Confirmation_Page(WebDriver driver){
super(driver);
}
public static WebElement txt_ProductName() throws Exception{
try{
element = driver.findElement(By.xpath(""+
".//*[@id='post-30']/div/div[2]/table/tbody/tr/td[1]")); Log.info("Product name is found on the Confirmation Page"); }catch (Exception e){ Log.error("Product name is not found on the Confirmation Page"); throw(e); } return element; } public static WebElement txt_ProductPrice() throws Exception{ try{ element = driver.findElement(By.xpath(""+ ".//*[@id='post-30']/div/div[2]/table/tbody/tr/td[4]")); Log.info("Product price is found on the Confirmation Page"); }catch (Exception e){ Log.error("Product price is not found on the Confirmation Page"); throw(e); } return element; } } |
Very nice information. It was informative for me. Keep it up.
ReplyDeleteBest Data Science Online Training Institute In Hyderabad | Online Data Science Training
nice code
ReplyDeleteApplication packagining training
Blockchain training
C training
Data power training
Data Stage training
Dynamic CRM Training
Informatica idq training
Thank you sharing for this nice blog...
ReplyDeleteData power training
Data Stage training
Dynamic CRM Training
Informatica idq training
Nice post....
ReplyDeleteData power training
Data Stage training
Dynamic CRM Training
Informatica idq training
Good post...
ReplyDeleteOpen stack training
Manual Testing training
SAP ABAP training
SAP Basis training