本文整理汇总了Java中org.openqa.selenium.By.toString方法的典型用法代码示例。如果您正苦于以下问题:Java By.toString方法的具体用法?Java By.toString怎么用?Java By.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.By
的用法示例。
在下文中一共展示了By.toString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.openqa.selenium.By; //导入方法依赖的package包/类
@Override
public void run() {
super.run();
By locator = readLocatorArgument("locator");
String swipeDirection = readStringArgument("swipe", "none");
swipeAndCheckElementVisible(locator, swipeDirection);
MobileElement element = getElement(locator);
//String enabledState = element.getAttribute("enabled");
String checkedState = element.getAttribute("checked");
if (checkedState.equalsIgnoreCase("true")) {
System.out.println("Element is checked: " + locator.toString());
} else {
throw new RuntimeException("Element is not checked: " + locator.toString());
}
}
示例2: run
import org.openqa.selenium.By; //导入方法依赖的package包/类
@Override
public void run() {
super.run();
By locator = readLocatorArgument("locator");
String swipeDirection = readStringArgument("swipe", "none");
swipeAndCheckElementVisible(locator, swipeDirection);
MobileElement element = getElement(locator);
//String enabledState = element.getAttribute("enabled");
String checkedState = element.getAttribute("checked");
if (checkedState.equalsIgnoreCase("false")) {
System.out.println("Element is unchecked: " + locator.toString());
} else {
throw new RuntimeException("Element is checked: " + locator.toString());
}
}
示例3: toString
import org.openqa.selenium.By; //导入方法依赖的package包/类
@Override
public String toString()
{
By by = getBy();
String srtBy = (by == null ? "null locator" : by.toString());
return srtBy;
}
示例4: endScroll
import org.openqa.selenium.By; //导入方法依赖的package包/类
protected void endScroll(By locator, String direction) {
boolean elementWasFound = false;
boolean swipe = true;
String lastElement = null;
while (swipe) {
try {
waitForElementVisible(locator, 1);
elementWasFound = true;
String message = "Found element " + locator.toString();
System.out.println(message);
break;
} catch (Exception ex) {
if (direction.equalsIgnoreCase("none")) {
throw new RuntimeException(String.format("Element %s not found", locator.toString()));
}
/*
* if (returnElementPosition(findElement(locator, 1))) {
* swipe(direction); } else { break; }
*/
}
}
if (!elementWasFound) {
throw new RuntimeException(String.format("Could not find element %s", locator));
}
}
示例5: run
import org.openqa.selenium.By; //导入方法依赖的package包/类
@Override
public void run() {
super.run();
By locator = readLocatorArgument("locator");
String swipeDirection = readStringArgument("swipe", "none");
swipeAndCheckElementVisible(locator, swipeDirection);
MobileElement element = getElement(locator);
if (AppiumHelper.isPlatform("android")) {
//String enabledState = element.getAttribute("enabled");
String clickableState = element.getAttribute("clickable");
if (clickableState.equalsIgnoreCase("true")) {
} else {
throw new RuntimeException("Element is disabled: " + locator.toString());
}
} else {
By locatorEnabled = readLocatorArgumentUpdateWithEnabled("locator");
if (driver.findElements(locatorEnabled).size() > 0) {
} else {
throw new RuntimeException("Element is disabled: " + locator.toString());
}
}
}
示例6: run
import org.openqa.selenium.By; //导入方法依赖的package包/类
@Override
public void run() {
super.run();
By locator = readLocatorArgument("locator");
String swipeDirection = readStringArgument("swipe", "none");
swipeAndCheckElementVisible(locator, swipeDirection);
MobileElement element = getElement(locator);
if (AppiumHelper.isPlatform("android")) {
String enabledState = element.getAttribute("enabled");
String clickableState = element.getAttribute("clickable");
if (enabledState.equalsIgnoreCase("false") || clickableState.equalsIgnoreCase("false")) {
System.out.println("Element is disabled: " + locator.toString());
} else {
throw new RuntimeException("Element is enabled: " + locator.toString());
}
} else {
By locatorEnabled = readLocatorArgumentUpdateWithEnabled("locator");
if (driver.findElements(locatorEnabled).size() > 0) {
throw new RuntimeException("Element is enabled: " + locator.toString());
} else {
System.out.println("Element is disabled: " + locator.toString());
}
}
}
示例7: BaseElement
import org.openqa.selenium.By; //导入方法依赖的package包/类
public BaseElement(By by) {
this.by = by;
oriElementStr = by.toString();
}
示例8: valueOf
import org.openqa.selenium.By; //导入方法依赖的package包/类
/**
* Get the underlying value of the specified Selenium locator
*
* @param locator Selenium locator
* @return value extracted from the specified locator
*/
private static String valueOf(By locator) {
String str = locator.toString();
int i = str.indexOf(':');
return str.substring(i + 1).trim();
}