Perform() not working on web element

I am new to appium and trying to automate my web view in my app. I have added touchend event listener to a div. Now i want to fire this event from appium using touchAction class.

I tired touchAction on sample native app. It works , but it doesn’t work for Web element in my app. What I am doing wrong?
I went through the following posts but i am not able to solve this issue

touch-actions-and-mobile-web/795
having-problems-with-appium-executing-perform/177/17

Here’s the error : -
org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 6 milliseconds
Build info: version: ‘2.45.0’, revision: ‘5017cb8’, time: ‘2015-02-26 23:59:50’
System info: host: ‘lab-mac-aee074’, ip: ‘10.192.18.170’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.3’, java.version: ‘1.8.0_40’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{app=/Users/labuser/Library/Developer/Xcode/DerivedData/x-ebjypaqeckllutepszxlfjpmksnn/Build/Products/Debug-iphonesimulator/x.app, networkConnectionEnabled=false, warnings={}, databaseEnabled=false, deviceName=iPad Air, platform=MAC, desired={app=/Users/labuser/Library/Developer/Xcode/DerivedData/x-ebjypaqeckllutepszxlfjpmksnn/Build/Products/Debug-iphonesimulator/x.app, appium-version=1.0, platformVersion=8.2, platformName=iOS, deviceName=iPad Air}, appium-version=1.0, platformVersion=8.2, webStorageEnabled=false, locationContextEnabled=false, browserName=iOS, takesScreenshot=true, javascriptEnabled=true, platformName=iOS}]
Session ID: 61fee5d5-c57a-4c48-a1c2-15d678774579
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at io.appium.java_client.AppiumDriver.performTouchAction(AppiumDriver.java:293)
at io.appium.java_client.TouchAction.perform(TouchAction.java:301)
at com.x.x.FirstTest.testLocation(FirstTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Here is my code : -

        driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);
	Set<String> contextNames = driver.getContextHandles();
	for (String contextName : contextNames) {
	  System.out.println(contextName);
	  if (contextName.contains("WEBVIEW")){
	    driver.context(contextName);
	  }
	}
	
	WebElement wb = driver.findElement(By.id("thumb_sample1"));
	TouchAction testAction = new TouchAction(driver);
	testAction.tap(wb).perform();

I am using the latest version of appium 1.3.7 , java-client 2.2.0 , selenium 2.45.0

Dear Tarun,

Try this,

Set contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName);
if (contextName.contains(“WEBVIEW”)){
driver.contextName.click();
}
}

Hi skbabu,
I tried your above mentioned lines of code.
I faced the following error :

contextName cannot be resolved or is not a field

shows up in your provided solution.

What we are trying to do by click in your code ?
Thanks for your reply.

((AppiumDriver)driver).tap(numOfFingers,WebElement,durationInMilliSeconds);

Hi amedvedev,

Thanks for your reply!
But It still doesn’t work. It gives the same error. Can I try something else?

I read somewhere that IOS drivers have been implemented from AppiumDriver. Why do we need to cast it in your code?

Also it was written in some post that when i use touchAction class , it uses the class of selenium and not appium. But i was not able to solve the issue as it was not clear.

ok. i am still with 1.3.6.

what about - ((IOSDriver)driver).tap(numOfFingers,WebElement,durationInMilliSeconds);

Why do we need to cast it in your code? - i need it cause i use Google Page Source functionality to walk though pages and mine driver is normal Selenium.

That also didn’t worked! :frowning:

share Appium server error