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
bcbb49ae
Commit
bcbb49ae
authored
Nov 12, 2024
by
Qazi Zain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajax Call Hanndling code added in repo
parent
949460eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
0 deletions
+96
-0
AjaxCall.java
...va/Handling_SSL_Certification_and_AJAXCalls/AjaxCall.java
+56
-0
SSLCertificate.java
...dling_SSL_Certification_and_AJAXCalls/SSLCertificate.java
+17
-0
JsExecutor.java
src/test/java/JsExecutor/JsExecutor.java
+23
-0
No files found.
src/test/java/Handling_SSL_Certification_and_AJAXCalls/AjaxCall.java
0 → 100644
View file @
bcbb49ae
package
Handling_SSL_Certification_and_AJAXCalls
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.JavascriptExecutor
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.openqa.selenium.support.ui.ExpectedConditions
;
import
org.openqa.selenium.support.ui.WebDriverWait
;
import
java.time.Duration
;
public
class
AjaxCall
{
public
static
void
main
(
String
[]
args
)
{
//---------------> here i am creating an object of firefox browser.
WebDriver
obj
=
new
FirefoxDriver
();
//---------------------> Defining the Explicit time.
WebDriverWait
wait
=
new
WebDriverWait
(
obj
,
Duration
.
ofSeconds
(
5
));
//-------> Fetch the link and open the web on browser of which object is created.
obj
.
get
(
"http://omayo.blogspot.com/"
);
// creating javaScript Executor.
JavascriptExecutor
js
=
(
JavascriptExecutor
)
obj
;
js
.
executeScript
(
"window.scrollBy(0,1400)"
);
// for scroll web downwards.
js
.
executeScript
(
"window.scrollBy(60,0)"
);
// for scroll web right side.
//---------------------------------------> (Finding the Locator of Dropdown Button) <-----------------------------------
//---> creating a button and storing a locator for maintainability of code.
WebElement
DropdownButton
=
obj
.
findElement
(
By
.
cssSelector
(
"button.dropbtn"
));
DropdownButton
.
click
();
WebElement
FlipkartButton
=
obj
.
findElement
(
By
.
xpath
(
"//div[@id='myDropdown']/a[2]"
));
//--------------------------------------> Adding Explicit wait to handle ajax call.
wait
.
until
(
ExpectedConditions
.
visibilityOf
(
FlipkartButton
));
FlipkartButton
.
click
();
}
}
src/test/java/Handling_SSL_Certification_and_AJAXCalls/SSLCertificate.java
0 → 100644
View file @
bcbb49ae
package
Handling_SSL_Certification_and_AJAXCalls
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.openqa.selenium.firefox.FirefoxOptions
;
public
class
SSLCertificate
{
public
static
void
main
(
String
[]
args
)
{
FirefoxOptions
SSL
=
new
FirefoxOptions
();
SSL
.
setAcceptInsecureCerts
(
true
);
WebDriver
obj
=
new
FirefoxDriver
(
SSL
);
// passing ssl object in parameter to bypass SSL Certification.
obj
.
get
(
"https://expired.badssl.com/"
);
}
}
src/test/java/JsExecutor/JsExecutor.java
0 → 100644
View file @
bcbb49ae
package
JsExecutor
;
import
org.openqa.selenium.JavascriptExecutor
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
public
class
JsExecutor
{
public
static
void
main
(
String
[]
args
)
{
WebDriver
obj
=
new
FirefoxDriver
();
obj
.
get
(
"https://rahulshettyacademy.com/AutomationPractice/"
);
// Creating JavaScript Executor Object.
JavascriptExecutor
js
=
(
JavascriptExecutor
)
obj
;
// casting obj as javascript executor to store in js object.
js
.
executeScript
(
"window.scrollBy(0,700)"
);
}
}
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