本文整理汇总了Java中org.openqa.selenium.NoSuchSessionException类的典型用法代码示例。如果您正苦于以下问题:Java NoSuchSessionException类的具体用法?Java NoSuchSessionException怎么用?Java NoSuchSessionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoSuchSessionException类属于org.openqa.selenium包,在下文中一共展示了NoSuchSessionException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: longPress
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:54:58 PM
*/
public void longPress () {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Performing long press on element [%s]...", this.name));
try {
final int beforeTap = this.device.getSetting ()
.getDelayBeforeTap ();
final int afterTap = this.device.getSetting ()
.getDelayAfterTap ();
this.touch.waitAction (ofSeconds (beforeTap))
.longPress (this.element)
.waitAction (ofSeconds (afterTap))
.perform ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:22,代码来源:DeviceElementActions.java
示例2: tap
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 12-May-2017 10:08:55 PM
*/
public void tap () {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Tapping on element [%s]...", this.name));
try {
final int beforeTap = this.device.getSetting ()
.getDelayBeforeTap ();
final int afterTap = this.device.getSetting ()
.getDelayAfterTap ();
this.touch.waitAction (ofSeconds (beforeTap))
.tap (this.element)
.waitAction (ofSeconds (afterTap))
.perform ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:22,代码来源:DeviceElementActions.java
示例3: webGet2
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
public static void webGet2(WebDriver webDriver, String url) {
try {
webDriver.get(url);
webGet2(webDriver, url);
} catch (Exception e) {
// e.printStackTrace();
if (e instanceof NoSuchSessionException) {
System.out.println("浏览器关闭,程序退出");
System.exit(0);
}
/*
* try { Thread.sleep(100); } catch (InterruptedException e1) {
* e1.printStackTrace(); } JavascriptExecutor js =
* (JavascriptExecutor) webDriver;
* js.executeScript("window.stop();");
* System.out.println("已停止加载页面》》》》》》》》》》》》》》》》》》》》》》》》");
*/
}
}
开发者ID:xiaomin0322,项目名称:alimama,代码行数:20,代码来源:ShuaOline.java
示例4: captureScreen
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
@Override
public byte[] captureScreen() {
if (driver == null) {
return null;
}
if (!(driver instanceof TakesScreenshot)) {
return null;
}
try {
return ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
} catch (NoSuchSessionException e) {
// just do nothing if WebDriver instance is in invalid state
return null;
}
// TODO test should not fail when taking screen capture fails?
}
开发者ID:SahaginOrg,项目名称:sahagin-java,代码行数:18,代码来源:WebDriverScreenCaptureAdapter.java
示例5: captureScreen
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
@Override
public byte[] captureScreen() {
if (fluent == null) {
return null;
}
WebDriver driver = fluent.getDriver();
if (driver == null) {
return null;
}
if (!(driver instanceof TakesScreenshot)) {
return null;
}
try {
return ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
} catch (NoSuchSessionException e) {
// just do nothing if WebDriver instance is in invalid state
return null;
}
}
开发者ID:SahaginOrg,项目名称:sahagin-java,代码行数:21,代码来源:FluentLeniumAdapter.java
示例6: appendText
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since Oct 21, 2017 5:22:04 PM
* @param text
*/
public void appendText (final String text) {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
tap ();
log.info (String.format ("Appending text [%s] in element [%s]...", text, this.name));
try {
this.element.sendKeys (text);
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:17,代码来源:DeviceElementActions.java
示例7: clear
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:49:52 PM
*/
public void clear () {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Clearing element [%s]...", this.name));
try {
this.element.clear ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:15,代码来源:DeviceElementActions.java
示例8: enabled
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:51:07 PM
* @return enabled
*/
public boolean enabled () {
log.info (String.format ("Checking if element [%s] is enabled...", this.name));
try {
return this.element.isEnabled ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
return false;
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:16,代码来源:DeviceElementActions.java
示例9: enterText
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:31:45 PM
* @param text
*/
public void enterText (final String text) {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
tap ();
clear ();
log.info (String.format ("Entering text [%s] in element [%s]...", text, this.name));
try {
this.element.sendKeys (text);
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:18,代码来源:DeviceElementActions.java
示例10: pinch
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:49:08 PM
*/
public void pinch () {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Pinching on element [%s]...", this.name));
try {
fail (NotImplementedError.class, "Pinch! Coming Soon!!");
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:15,代码来源:DeviceElementActions.java
示例11: selected
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:50:40 PM
* @return selected
*/
public boolean selected () {
log.info (String.format ("Checking if element [%s] is selected...", this.name));
try {
return this.element.isSelected ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
return false;
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:16,代码来源:DeviceElementActions.java
示例12: submit
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 06-May-2017 4:56:42 PM
*/
public void submit () {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Performing submit on element [%s]...", this.name));
try {
this.element.submit ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:15,代码来源:DeviceElementActions.java
示例13: swipe
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 12-May-2017 10:07:14 PM
* @param direction
*/
public void swipe (final SwipeDirection direction) {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Swiping [%s] on element [%s]...", direction, this.name));
try {
fail (NotImplementedError.class, "Swipe! Coming Soon!!");
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:16,代码来源:DeviceElementActions.java
示例14: text
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:52:40 PM
* @return text
*/
public String text () {
log.info (String.format ("Getting text on element [%s]...", this.name));
try {
return this.element.getText ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
return null;
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:16,代码来源:DeviceElementActions.java
示例15: visible
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:51:40 PM
* @return visible
*/
public boolean visible () {
log.info (String.format ("Checking if element [%s] is visible...", this.name));
try {
return this.element.isDisplayed ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
return false;
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:16,代码来源:DeviceElementActions.java
示例16: zoom
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:48:10 PM
*/
public void zoom () {
DeviceChecker.checkDeviceElementEnabled (this.element, this.name);
log.info (String.format ("Zooming on element [%s]...", this.name));
try {
fail (NotImplementedError.class, "Zoom! Coming Soon!!");
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:15,代码来源:DeviceElementActions.java
示例17: hideKeyboard
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 8:34:05 PM
*/
public void hideKeyboard () {
log.info ("Hiding the keyboard...");
try {
this.driver.hideKeyboard ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:14,代码来源:DeviceActions.java
示例18: captureScreenshot
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 01-May-2017 8:24:34 PM
* @param path
*/
private void captureScreenshot (final String path) {
final String msg = "Capturing screenshot and saving at [%s]...";
log.info (format (msg, path));
try {
final File srcFiler = this.driver.getScreenshotAs (OutputType.FILE);
copyFile (srcFiler, path);
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:17,代码来源:DeviceActions.java
示例19: hideKeyboard
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
@Override
public void hideKeyboard () {
log.info ("Hiding keyboard on device...");
try {
this.driver.hideKeyboard ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:11,代码来源:WindowsDeviceActions.java
示例20: currentActivity
import org.openqa.selenium.NoSuchSessionException; //导入依赖的package包/类
/**
* @author wasiq.bhamla
* @since 26-Apr-2017 9:09:43 PM
* @return activity
*/
public String currentActivity () {
log.info ("Getting current activity name...");
try {
return this.driver.currentActivity ();
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
return null;
}
开发者ID:WasiqB,项目名称:coteafs-appium,代码行数:16,代码来源:AndroidDeviceActions.java
注:本文中的org.openqa.selenium.NoSuchSessionException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论