-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(selenium): add ReadUrl and deprecate ReadCurrentUrl
- Loading branch information
Showing
2 changed files
with
34 additions
and
29 deletions.
There are no files selected for viewing
31 changes: 2 additions & 29 deletions
31
actor/selenium/src/main/java/org/getopentest/selenium/ReadCurrentUrl.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 |
---|---|---|
@@ -1,32 +1,5 @@ | ||
package org.getopentest.selenium; | ||
|
||
import org.getopentest.selenium.core.SeleniumTestAction; | ||
import java.net.URL; | ||
|
||
public class ReadCurrentUrl extends SeleniumTestAction { | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
|
||
try { | ||
String urlValue = driver.getCurrentUrl(); | ||
URL currentUrl = new URL(urlValue); | ||
|
||
this.writeOutput("anchor", currentUrl.getRef()); | ||
this.writeOutput("authority", currentUrl.getAuthority()); | ||
this.writeOutput("defaultPort", currentUrl.getDefaultPort()); | ||
this.writeOutput("file", currentUrl.getFile()); | ||
this.writeOutput("host", currentUrl.getHost()); | ||
this.writeOutput("path", currentUrl.getPath()); | ||
int port = currentUrl.getPort(); | ||
this.writeOutput("port", port > 0 ? port : null); | ||
this.writeOutput("protocol", currentUrl.getProtocol()); | ||
this.writeOutput("query", currentUrl.getQuery()); | ||
this.writeOutput("userInfo", currentUrl.getUserInfo()); | ||
this.writeOutput("url", urlValue); | ||
} catch (Throwable ex) { | ||
throw new RuntimeException("Failed reading the current URL", ex); | ||
} | ||
} | ||
@Deprecated | ||
public class ReadCurrentUrl extends ReadUrl { | ||
} |
32 changes: 32 additions & 0 deletions
32
actor/selenium/src/main/java/org/getopentest/selenium/ReadUrl.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,32 @@ | ||
package org.getopentest.selenium; | ||
|
||
import org.getopentest.selenium.core.SeleniumTestAction; | ||
import java.net.URL; | ||
|
||
public class ReadUrl extends SeleniumTestAction { | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
|
||
try { | ||
String urlValue = driver.getCurrentUrl(); | ||
URL currentUrl = new URL(urlValue); | ||
|
||
this.writeOutput("anchor", currentUrl.getRef()); | ||
this.writeOutput("authority", currentUrl.getAuthority()); | ||
this.writeOutput("defaultPort", currentUrl.getDefaultPort()); | ||
this.writeOutput("file", currentUrl.getFile()); | ||
this.writeOutput("host", currentUrl.getHost()); | ||
this.writeOutput("path", currentUrl.getPath()); | ||
int port = currentUrl.getPort(); | ||
this.writeOutput("port", port > 0 ? port : null); | ||
this.writeOutput("protocol", currentUrl.getProtocol()); | ||
this.writeOutput("query", currentUrl.getQuery()); | ||
this.writeOutput("userInfo", currentUrl.getUserInfo()); | ||
this.writeOutput("url", urlValue); | ||
} catch (Throwable ex) { | ||
throw new RuntimeException("Failed reading the current URL", ex); | ||
} | ||
} | ||
} |