Can be use AppiumDriver and WebDriver for Same instance

Hi Team,

I am facing problem the appiumDriver : i have to verify some thing into Web then reflect changes are verified on Mobile native app.
So for verifying web part i am using WebDriver
And native mobile some part done with WebDriver but webdriver don’t support swipe function.

So my Question: How i will swipe my native app.

Note: Currently i am Using WebDriver only for web and Native both.

Can we call appium function into WebDriver for verifying Android and iOS ?

Hello Tarun,

So from your question I get to understand you are using WebDriver reference object for handling Mobile web and native actions. In this context we should be able to achieve the required functionality by defining the driver instance as below for android platform:

WebDriver driver = new AndroidDriver<MobileElement>(); 
driver.findElement(By.Id("button")); //this would work on both web or native as per the context

//to work on native part we can typecast the driver instance as below
if ( driver instanceof AndroidDriver ) {
         (AndroidDriver<MobileElement>(driver)).findElementByAndroidUIAutomator("locator");
}

We need to cast the driver as per the requirement and call the api on it

Thanks for quick replay
When i am using
WebDriver driver = new AndroidDriver(); // issue : need to add argument
WebDriver driver = new AndroidDriver(DesiredCapabilities); // issue I have added Capabilities

and

(AndroidDriver(driver)).findElementByAndroidUIAutomator(“locator”); // Unable to find AndroidDriver and MobileElement

So I need to do on Both iOS and Android and I am using

io.appium
java-client
3.2.0

MAVEN dependency.