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
08a5f2c4
Commit
08a5f2c4
authored
Nov 07, 2024
by
Qazi Zain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sixth Commit in which i have added Auto Suggestive Dropdown
parent
d29d8db6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
WebElementAutomation.java
...hniques_to_automate_web_Element/WebElementAutomation.java
+18
-0
No files found.
src/test/java/Techniques_to_automate_web_Element/WebElementAutomation.java
View file @
08a5f2c4
...
@@ -6,6 +6,8 @@ import org.openqa.selenium.WebElement;
...
@@ -6,6 +6,8 @@ import org.openqa.selenium.WebElement;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.openqa.selenium.support.ui.Select
;
import
org.openqa.selenium.support.ui.Select
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
WebElementAutomation
{
public
class
WebElementAutomation
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
WebDriver
obj
=
new
FirefoxDriver
();
WebDriver
obj
=
new
FirefoxDriver
();
...
@@ -63,6 +65,22 @@ public class WebElementAutomation {
...
@@ -63,6 +65,22 @@ public class WebElementAutomation {
obj
.
findElement
(
By
.
xpath
(
"(//a[@text='Chennai (MAA)'])[2]"
)).
click
();
// usually use that kind of xpath when full path also give similar value.
obj
.
findElement
(
By
.
xpath
(
"(//a[@text='Chennai (MAA)'])[2]"
)).
click
();
// usually use that kind of xpath when full path also give similar value.
//---------------------------------> Auto suggestive Dropdown <----------------------------------------------
obj
.
findElement
(
By
.
id
(
"autosuggest"
)).
sendKeys
(
"ind"
);
Thread
.
sleep
(
3000
);
List
<
WebElement
>
obj2
=
obj
.
findElements
(
By
.
cssSelector
(
"li[class='ui-menu-item'] a"
));
for
(
WebElement
objects:
obj2
)
{
if
(
objects
.
getText
().
equalsIgnoreCase
(
"India"
))
{
objects
.
click
();
}
}
}
}
}
}
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