
org.phoenix.action.WebElementLocator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phoenix_webdriver Show documentation
Show all versions of phoenix_webdriver Show documentation
update:检查点bug修复,增加js执行的驱动,commandExecutor方法bug修复,驱动更新支持最新Firefox47/chrome51/IE10/IE11/IE Edge
package org.phoenix.action;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import org.openqa.selenium.By;
import org.phoenix.enums.LocatorType;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;
/**
* 定位类型选择
* @author mengfeiyang
*
*/
public class WebElementLocator {
protected SelenideElement WebElement(String locator, LocatorType locatorType){
switch (locatorType) {
case CSS: return $(locator);
case NAME: return $(By.name(locator));
case XPATH: return $(By.xpath(locator));
case LINKTEXT:return $(By.linkText(locator));
case TAGNAME:return $(By.tagName(locator));
case PARTIALLINKTEXT:return $(By.partialLinkText(locator));
default:;
}
return null;
}
protected By by(String locator, LocatorType locatorType){
switch (locatorType) {
case CSS: return By.cssSelector(locator);
case NAME: return By.name(locator);
case XPATH: return By.xpath(locator);
case LINKTEXT:return By.linkText(locator);
case TAGNAME:return By.tagName(locator);
case PARTIALLINKTEXT:By.partialLinkText(locator);
default:;
}
return null;
}
protected ElementsCollection WebElements(String locator, LocatorType locatorType){
switch (locatorType) {
case CSS: return $$(locator);
case NAME: return $$(By.name(locator));
case XPATH: return $$(By.xpath(locator));
case LINKTEXT:return $$(By.linkText(locator));
case TAGNAME:return $$(By.tagName(locator));
case PARTIALLINKTEXT:return $$(By.partialLinkText(locator));
default:;
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy