Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SeleniumTraining
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qazi Zain
SeleniumTraining
Commits
16a1ab58
Commit
16a1ab58
authored
Nov 11, 2024
by
Qazi Zain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
click button is updated and generic
parent
84875cf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
Practice.java
src/test/java/FunctionalTesting/Practice.java
+27
-8
No files found.
src/test/java/FunctionalTesting/Practice.java
View file @
16a1ab58
...
...
@@ -24,22 +24,22 @@ public class Practice {
SoftAssert
test
=
new
SoftAssert
();
WebElement
broklebutton
=
obj
.
findElement
(
By
.
xpath
(
"//div[@class='products-wrapper']/div/div/h4[text()='Brocolli - 1 Kg']/following-sibling::div[@class='stepper-input']/a[@class='increment'][1]"
))
;
WebElement
incrementButton
;
WebElement
culiFlower
=
obj
.
findElement
(
By
.
xpath
(
"//div[@class='products-wrapper']/div/div/h4[text()='Cauliflower - 1 Kg']/following-sibling::div[@class='stepper-input']/a[@class='increment'][1]"
));
for
(
int
i
=
1
;
i
<=
3
;
i
++)
for
(
int
i
=
1
;
i
<=
6
;
i
++)
{
String
buttonXPath
=
"(//div[@class='product-action']/button)["
+
i
+
"]"
;
button
=
object
.
until
(
ExpectedConditions
.
elementToBeClickable
(
By
.
xpath
(
buttonXPath
)));
String
incrementXpath
=
"(//a[@class='increment'])["
+
i
+
"]"
;
incrementButton
=
object
.
until
(
ExpectedConditions
.
elementToBeClickable
(
By
.
xpath
(
incrementXpath
)));
if
(
i
==
1
)
{
int
j
;
for
(
j
=
1
;
j
<=
5
;
j
++)
{
object
.
until
(
ExpectedConditions
.
elementToBeClickable
(
broklebutton
));
broklebutton
.
click
();
incrementButton
.
click
();
}
test
.
assertTrue
(
j
==
2
,
"5 items added in cart"
);
...
...
@@ -52,9 +52,20 @@ public class Practice {
int
j
;
for
(
j
=
1
;
j
<=
7
;
j
++)
{
incrementButton
.
click
();
}
test
.
assertFalse
(
j
>
3
,
"If not meets return false"
);
button
.
click
();
}
object
.
until
(
ExpectedConditions
.
elementToBeClickable
(
culiFlower
));
culiFlower
.
click
();
else
if
(
i
==
5
)
{
int
j
;
for
(
j
=
1
;
j
<=
7
;
j
++)
{
incrementButton
.
click
();
}
test
.
assertFalse
(
j
>
3
,
"If not meets return false"
);
...
...
@@ -62,6 +73,14 @@ public class Practice {
}
}
WebElement
cart
=
obj
.
findElement
(
By
.
xpath
(
"//div[@class='cart']/a/img"
));
obj
.
manage
().
window
().
maximize
();
object
.
until
(
ExpectedConditions
.
elementToBeClickable
(
cart
));
cart
.
click
();
test
.
assertAll
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment