forked from EmbedITCZ/jbehave-support
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New web steps for tabs and frames. (EmbedITCZ#127)
* New web steps for tabs and frames. FORCE_CLICK web action. Documentation for web steps amended.
- Loading branch information
Showing
12 changed files
with
244 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ave-support-core-test/jbehave-support-core-test-app/src/main/resources/static/frames.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Marvelous Frames</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Page with marvelous title and iframes</h1> | ||
<div> | ||
<p><span>Frame number: </span><span data-selector="number">0</span></p> | ||
<iframe title="firstFrame" src="/iframes/first-frame.html"> | ||
</iframe> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
...ore-test/jbehave-support-core-test-app/src/main/resources/static/iframes/first-frame.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>firstFrame</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<p><span>Frame number: </span><span data-selector="number">1</span></p> | ||
<iframe title="secondFrame" src="/iframes/second-frame.html"> | ||
</iframe> | ||
</div> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
...re-test/jbehave-support-core-test-app/src/main/resources/static/iframes/second-frame.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>secondFrame</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<p><span>Frame number: </span><span data-selector="number">2</span></p> | ||
<iframe title="thirdFrame" src="/iframes/third-frame.html"> | ||
</iframe> | ||
</div> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
...ore-test/jbehave-support-core-test-app/src/main/resources/static/iframes/third-frame.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>thirdFrame</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<p><span>Frame number: </span><span data-selector="number">3</span></p> | ||
<p><span>This is last frame</span></p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...t-core/src/main/java/org/jbehavesupport/core/internal/web/action/ForceClickWebAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.jbehavesupport.core.internal.web.action; | ||
|
||
import org.jbehavesupport.core.web.WebActionContext; | ||
import org.openqa.selenium.JavascriptExecutor; | ||
import org.openqa.selenium.WebElement; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ForceClickWebAction extends AbstractWebAction { | ||
|
||
@Override | ||
public String name() { | ||
return "FORCE_CLICK"; | ||
} | ||
|
||
@Override | ||
public void perform(WebActionContext ctx) { | ||
if (!(driver instanceof JavascriptExecutor)) { | ||
throw new AssertionError("WebDriver must implement javascript to use FORCE_CLICK"); | ||
} | ||
WebElement element = elementLocator.findElement(ctx.getPage(), ctx.getElement()); | ||
JavascriptExecutor jse2 = (JavascriptExecutor) driver; | ||
jse2.executeScript("arguments[0].click();", element); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters