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
bce64ad6
Commit
bce64ad6
authored
Nov 25, 2024
by
Qazi Zain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter, and pagination code is added
parent
41bf91e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
9 deletions
+106
-9
.gitignore
.gitignore
+1
-0
Filtering.java
src/test/java/Streams/Filtering.java
+44
-0
Pagenation.java
src/test/java/Streams/Pagenation.java
+59
-0
testng.xml
testng.xml
+2
-9
No files found.
.gitignore
View file @
bce64ad6
...
@@ -50,4 +50,5 @@ test.txt
...
@@ -50,4 +50,5 @@ test.txt
allure-results
allure-results
testng.xml
src/test/java/Streams/Filtering.java
0 → 100644
View file @
bce64ad6
package
Streams
;
import
java.time.Duration
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.chrome.ChromeDriver
;
import
org.openqa.selenium.chrome.ChromeOptions
;
import
org.openqa.selenium.support.ui.ExpectedConditions
;
import
org.openqa.selenium.support.ui.WebDriverWait
;
public
class
Filtering
{
public
static
void
main
(
String
[]
args
)
{
ChromeOptions
ssl
=
new
ChromeOptions
();
ssl
.
setAcceptInsecureCerts
(
true
);
WebDriver
obj
=
new
ChromeDriver
(
ssl
);
obj
.
get
(
"https://www.daraz.pk/#?"
);
WebElement
searchBox
=
obj
.
findElement
(
By
.
cssSelector
(
"input[placeholder='Search in Daraz']"
));
searchBox
.
sendKeys
(
"gents chappal"
);
WebDriverWait
wait
=
new
WebDriverWait
(
obj
,
Duration
.
ofSeconds
(
10
));
List
<
WebElement
>
rows
=
wait
.
until
(
ExpectedConditions
.
visibilityOfAllElementsLocatedBy
(
By
.
xpath
(
"//div[@class='suggest-list--3Tm8']//a"
)));
List
<
String
>
results
=
new
ArrayList
<>();
//System.out.println(rows);
for
(
WebElement
e:
rows
)
{
results
.
add
(
e
.
getText
());
}
for
(
int
i
=
0
;
i
<
results
.
size
();
i
++)
{
System
.
out
.
println
(
"The item of filter: "
+
results
.
get
(
i
));
}
}
}
src/test/java/Streams/Pagenation.java
0 → 100644
View file @
bce64ad6
package
Streams
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.chrome.ChromeDriver
;
public
class
Pagenation
{
public
static
void
main
(
String
[]
args
)
{
WebDriver
obj
=
new
ChromeDriver
();
obj
.
get
(
"https://datatables.net/"
);
WebElement
searchBox
=
obj
.
findElement
(
By
.
xpath
(
"//div[@class='dt-search']//input"
));
searchBox
.
sendKeys
(
"london"
);
List
<
String
>
lists
=
new
ArrayList
<>();
boolean
button
=
true
;
while
(
button
)
{
List
<
WebElement
>
items
=
obj
.
findElements
(
By
.
xpath
(
"//div[@class='dt-layout-row dt-layout-table']//tbody/tr"
));
for
(
WebElement
e
:
items
)
{
lists
.
add
(
e
.
getText
());
}
try
{
WebElement
nextButton
=
obj
.
findElement
(
By
.
xpath
(
"//button[@class='dt-paging-button next']"
));
if
(
nextButton
.
isEnabled
())
{
nextButton
.
click
();
}
else
{
button
=
false
;
}
}
catch
(
Exception
e
)
{
button
=
false
;
}
}
for
(
String
value
:
lists
)
{
System
.
out
.
println
(
"Value fetched: "
+
value
);
}
obj
.
quit
();
}
}
\ No newline at end of file
testng.xml
View file @
bce64ad6
...
@@ -2,14 +2,7 @@
...
@@ -2,14 +2,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite
name=
"All Test Suite"
>
<suite
name=
"All Test Suite"
>
<test
verbose=
"2"
preserve-order=
"true"
<test
verbose=
"2"
preserve-order=
"true"
name=
"/Users/zain/Documents/SeleniumTraining/src/main/java/POM_Structure_code"
>
name=
"/Users/zain/Documents/SeleniumTraining/src/main/java/NisumWebTest/Cucumber"
>
<classes>
<classes/>
<class
name=
"POM_Structure_code.TestClasses.LoginTest"
>
<methods>
<include
name=
"LoginTest"
/>
<include
name=
"checked"
/>
</methods>
</class>
</classes>
</test>
</test>
</suite>
</suite>
\ No newline at end of file
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