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


Java RemoteWebElement类代码示例

本文整理汇总了Java中org.openqa.selenium.remote.RemoteWebElement的典型用法代码示例。如果您正苦于以下问题:Java RemoteWebElement类的具体用法?Java RemoteWebElement怎么用?Java RemoteWebElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RemoteWebElement类属于org.openqa.selenium.remote包,在下文中一共展示了RemoteWebElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: windowTitleWithPercentage

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
public void windowTitleWithPercentage() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setTitle("My %Dialog%");
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("click-me"));
    String id1 = ((RemoteWebElement) element1).getId();
    // driver.switchTo().window("My %25Dialog%25");
    TargetLocator switchTo = driver.switchTo();
    switchTo.window("My %Dialog%");
    WebElement element2 = driver.findElement(By.name("click-me"));
    String id2 = ((RemoteWebElement) element2).getId();
    AssertJUnit.assertEquals(id1, id2);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:JavaDriverTest.java

示例2: fixLocator

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
private void fixLocator(SearchContext context, String cssLocator,
                        WebElement element) {

    if (element instanceof RemoteWebElement) {
        try {
            @SuppressWarnings("rawtypes")
            Class[] parameterTypes = new Class[] { SearchContext.class,
                    String.class, String.class };
            Method m = element.getClass().getDeclaredMethod(
                    "setFoundBy", parameterTypes);
            m.setAccessible(true);
            Object[] parameters = new Object[] { context,
                    "css selector", cssLocator };
            m.invoke(element, parameters);
        } catch (Exception fail) {
            //NOOP Would like to log here?
        }
    }
}
 
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:20,代码来源:ByExtended.java

示例3: apply

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Object apply(Object result) {
	if (result instanceof Collection<?>) {
		Collection<QAFExtendedWebElement> results = (Collection<QAFExtendedWebElement>) result;
		return Lists.newArrayList(Iterables.transform(results, this));
	}

	result = super.apply(result);
	if(result instanceof RemoteWebElement){
		if(!(result instanceof QAFExtendedWebElement)){
			QAFExtendedWebElement ele = newRemoteWebElement();
			ele.setId(((RemoteWebElement)result).getId());
			return ele;
		}
	}
	return result;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:19,代码来源:QAFExtendedWebElement.java

示例4: fixLocator

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
private void fixLocator(SearchContext context, String cssLocator,
		WebElement element) {

	if (element instanceof RemoteWebElement) {
		try {
			@SuppressWarnings("rawtypes")
			Class[] parameterTypes = new Class[] { SearchContext.class,
					String.class, String.class };
			Method m = element.getClass().getDeclaredMethod("setFoundBy",
					parameterTypes);
			m.setAccessible(true);
			Object[] parameters = new Object[] { context, "css selector",
					cssLocator };
			m.invoke(element, parameters);
		} catch (Exception e) {
			logger.error("Something bad happened when fixing locator", e);
		}
	}
}
 
开发者ID:gautamsabba,项目名称:UIFramework,代码行数:20,代码来源:SizzleSelector.java

示例5: uploadFile

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
@Override
@Monitor
@RetryFailure(retryCount=3)
@JSHandle
public WebDriverController uploadFile(Object locator, String path) {
    LocalFileDetector detector = new LocalFileDetector();
    File localFile = detector.getLocalFile(path);
    ((RemoteWebElement)waitController().waitForElementPresence(locator)).setFileDetector(detector);
    waitController().waitForElementPresence(locator).sendKeys(localFile.getAbsolutePath());
    return this;
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:12,代码来源:WebDriverController.java

示例6: fixLocator

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
private void fixLocator(SearchContext context, String cssLocator,
		WebElement element) {

	if (element instanceof RemoteWebElement) {
		try {
			@SuppressWarnings("rawtypes")
			Class[] parameterTypes = new Class[] { SearchContext.class,
					String.class, String.class };
			Method m = element.getClass().getDeclaredMethod(
					"setFoundBy", parameterTypes);
			m.setAccessible(true);
			Object[] parameters = new Object[] { context,
					"css selector", cssLocator };
			m.invoke(element, parameters);
		} catch (Exception fail) {
			//NOOP Would like to log here? 
		}
	}
}
 
开发者ID:persado,项目名称:stevia,代码行数:20,代码来源:ByExtended.java

示例7: findElementGetsTheSameElementBetweenCalls

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
public void findElementGetsTheSameElementBetweenCalls() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("click-me"));
    String id1 = ((RemoteWebElement) element1).getId();
    WebElement element2 = driver.findElement(By.name("click-me"));
    String id2 = ((RemoteWebElement) element2).getId();
    AssertJUnit.assertEquals(id1, id2);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:JavaDriverTest.java

示例8: findElementGetsTheSameElementBetweenWindowCalls

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
public void findElementGetsTheSameElementBetweenWindowCalls() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("click-me"));
    String id1 = ((RemoteWebElement) element1).getId();
    driver.switchTo().window(titleOfWindow);
    WebElement element2 = driver.findElement(By.name("click-me"));
    String id2 = ((RemoteWebElement) element2).getId();
    AssertJUnit.assertEquals(id1, id2);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:JavaDriverTest.java

示例9: getLocationInView

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
public void getLocationInView() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("click-me"));
    try {
        ((RemoteWebElement) element1).getCoordinates().inViewPort();
        throw new MissingException(WebDriverException.class);
    } catch (WebDriverException e) {
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:JavaDriverTest.java

示例10: waitForPageLoad

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
protected final <T> T waitForPageLoad(Func<T> func) {
	RemoteWebElement oldHtml = (RemoteWebElement) driver.findElement(By.tagName("html"));

	T result = func.call();
	WebDriverWait wait = new WebDriverWait(driver, 30);
	wait.until((WebDriver input) -> {
		RemoteWebElement newHtml = (RemoteWebElement) driver.findElement(By.tagName("html"));
		return ! newHtml.getId().equals(oldHtml.getId());
	});

	return result;
}
 
开发者ID:RUB-NDS,项目名称:PrOfESSOS,代码行数:13,代码来源:BrowserSimulator.java

示例11: getTypeForProxy

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
private Class<?> getTypeForProxy() {
    Class<? extends SearchContext> driverClass = originalDriver.getClass();
    Iterable<Map.Entry<Class<? extends SearchContext>, Class<? extends WebElement>>> rules =
        elementRuleMap.entrySet();
    //it will return MobileElement subclass when here is something
    for (Map.Entry<Class<? extends SearchContext>, Class<? extends WebElement>> e : rules) {
        //that extends AppiumDriver or MobileElement
        if (e.getKey().isAssignableFrom(driverClass)) {
            return e.getValue();
        }
    } //it is compatible with desktop browser. So at this case it returns RemoteWebElement.class
    return RemoteWebElement.class;
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:14,代码来源:AppiumFieldDecorator.java

示例12: findElement

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
@Override
public WebElement findElement(By by) {
    WebElement e = getInstance().findElement(by);
    if (e instanceof RemoteWebElement) {
        e = new ClickAndWaitRemoteWebElement(e, this);
    }
    return e;
}
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:9,代码来源:WebDriverWrapper.java

示例13: findElements

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
@Override
public List<WebElement> findElements(By by) {
    List<WebElement> list = getInstance().findElements(by);
    List<WebElement> newList = new ArrayList<>(list.size());
    for (WebElement e : list) {
        if (e instanceof RemoteWebElement) {
            e = new ClickAndWaitRemoteWebElement(e, this);
        }
        newList.add(e);
    }
    return newList;
}
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:13,代码来源:WebDriverWrapper.java

示例14: cleanValueToSend

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
/**
 * When send keys is being executed in a input file=type {@link LocalFileDetector} must be configured for remote drivers. Additionally,
 * the file path is expanded to be absolute
 *
 * @param driver used to run commands
 * @param element receiving keys
 * @param value to be set to input file type
 * @return value expanded to absolute path if for input file type.
 */
private String cleanValueToSend(WebDriver driver, WebElement element, String value) {
	if (!StringUtils.equals(element.getAttribute(SeleniumFixture.INPUT_TYPE_ATTRIBUTE), SeleniumFixture.INPUT_TYPE_FILE_VALUE)) {
		return this.fitnesseMarkup.clean(value);
	}
	// set file detector for remote web elements. Local FirefoxDriver uses RemoteWebElement and
	if (element instanceof RemoteWebElement && !ClassUtils.isAssignable(driver.getClass(), FirefoxDriver.class)) {
		((RemoteWebElement) element).setFileDetector(new LocalFileDetector());
	}
	return this.fitnesseMarkup.cleanFile(value).getAbsolutePath();
}
 
开发者ID:andreptb,项目名称:fitnesse-selenium-slim,代码行数:20,代码来源:SeleniumFixture.java

示例15: tapById

import org.openqa.selenium.remote.RemoteWebElement; //导入依赖的package包/类
public boolean tapById(String id) {
	try{
		Map<String, ?> params = ImmutableMap.of("element", ((RemoteWebElement)driver.findElement(By.id(id))).getId());
		((RobotRemoteWebDriver)this.driver).execute(DriverCommand.TOUCH_SINGLE_TAP, params);
	}catch(Exception ex) {
		return false;
	}
	return true;
}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:10,代码来源:ChromeDriverClient.java


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