I am automating hybrid app, so for webview i need to scroll for selendroid, but its not happening. Anyone pls help me out.
Try this
http://selendroid.io/gestures.html
import: org.openqa.selenium.interactions.touch.TouchActionsWebElement pages = driver.findElement(By.id("vp_pages"));TouchActions flick = new TouchActions(driver).flick(pages, -100, 0, 0);flick.perform();
// flick params areflick(WebElement, xOffset, yOffset, speed);
Not working, still crashing
driver.getContext() is printing both native and webview context ??
Yes- like this - [WEBVIEW_0, NATIVE_APP]
app crashing on below line
TouchActions flick = new TouchActions(driver).flick(pages, 300, 0, 3000);
What is the error coming ?
Try this driver.swipe(100,800,100,300,3000); // It should scroll vertically for 500 pixels
I dont think driver.swipe will work for selendroid, even i tried it. no error coming jus appium server get shut down. below is my code
WebElement pages = driver.findElement(TestUtils.GetPropertiesWeb("AboutMeSwipeUp")); TouchActions flick = new TouchActions(driver).flick(pages, 0, -200, 1000); flick.perform();
Hi Yogendra,Below code snippet is working for me in Appium. Can you try it in Selendroid
//Methods to scroll in Webview public void WebPageScrollAndClickBtn(MobileElement ElementName) { JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("window.scrollTo(0,0)"); do { try{ ElementName.click(); break; } catch(Exception e){ js.executeScript("window.scrollBy(0, 200)"); } } while(true);
}
Can you please check with standalone selendroid ?
project is in appium, for webview im using selendroid. so not possible.
I use this script and it work well on context(“NATIVE_APP”) driver.swipe(100,800,100,300,3000); Thank amitjaincoer191