I'm using Appium for mobile automation of our project apk file. I have used all methods present in Appium driver, but can't figure out this one..getWrappedDriver ??? Can anyone please explain the use of this method in detail with an example?
Sooner response would be much appreciated :-) :-)
答案 0 :(得分:0)
如果使用WebDriver的方法FindElement()找到Selenium WebElement,那么您将获得一个WebElement类型的对象。如果要对此元素执行某些操作,则通常需要再次使用WebDriver实例。所以,如果你是有一个子函数,你想对元素做一些事情,那么你经常需要传入元素和驱动程序:
private void _DoSomethingWithElement(IWebElement element, IWebDriver driver)
{
driver.WaitForElementToBeVisible(element);
element.Click();
}
但这不是必要的,因为元素"知道"司机。这是您使用getWrappedDriver()的原因:从元素实例中获取驱动程序实例。例如:
private void _DoSomethingWithElement(IWebElement element)
{
IWebDriver driver = element.getWrappedDriver();
driver.WaitForElementToBeVisible(element);
element.Click();
}
对于使用Selenium页面工厂生成的元素,不不是这样。非常不幸!