当前位置: 首页>>代码示例>>Java>>正文


Java By.toString方法代码示例

本文整理汇总了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());
    }
}
 
开发者ID:mcdcorp,项目名称:opentest,代码行数:20,代码来源:AssertElementChecked.java

示例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());
    }
}
 
开发者ID:mcdcorp,项目名称:opentest,代码行数:20,代码来源:AssertElementUnchecked.java

示例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;
}
 
开发者ID:LinuxSuRen,项目名称:phoenix.webui.framework,代码行数:9,代码来源:AbstractLocator.java

示例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));
        }

    }
 
开发者ID:mcdcorp,项目名称:opentest,代码行数:30,代码来源:AppiumTestAction.java

示例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());
        }
    }
}
 
开发者ID:mcdcorp,项目名称:opentest,代码行数:29,代码来源:AssertElementEnabled.java

示例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());
        }
    }
}
 
开发者ID:mcdcorp,项目名称:opentest,代码行数:29,代码来源:AssertElementDisabled.java

示例7: BaseElement

import org.openqa.selenium.By; //导入方法依赖的package包/类
public BaseElement(By by) {
	this.by = by;
	oriElementStr = by.toString();
}
 
开发者ID:quanqinle,项目名称:WebAndAppUITesting,代码行数:5,代码来源:BaseElement.java

示例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();
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:12,代码来源:ByType.java


注:本文中的org.openqa.selenium.By.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。