1
votes

I am facing a problem and tested with different scenarios and no luck. I would like to hear new ideas and approaches to my problem.

Context: I am testing a mobile hybrid application using Robot Framework and Appium Library. At some point, I need to tap on an element to open it. This is actually the first problem because click will not work.

Problem 1: When I am using Webview context I am seeing an error:

WebdriverException: Message: Method has not yet been implemented

Problem 2: When I am using Native context the tap is working, however, the page that I am testing has a scroll, after I perform a scroll all the elements are misplaced and I can't tap on the right element.

I tried different approaches, even Execute Javascript to simulate the event but I also didn't find a solution.

var e;
var el=document.getElementsByClassName("class_name")[1];
e=document.createEvent("Event");
e.initEvent('tap',true,false);
el.dispatchEvent(e);    

Any new ideas?

1
Can you edit your question and add the Robot Framework script as well? In addition any errors you may encounter with that script. The relevant source code (XML) would be helpful too. - A. Kootstra

1 Answers

0
votes

I found a solution to my problem, finally. After integrate Selenium2Library and Appium Library I used a keyword like this to tap an element:

Execute Javascript        var e;
    ...                   var el=document.evaluate(
    ...                     '${xpath_element}',
    ...                     document,
    ...                     null,
    ...                     XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
    ...                     null
    ...                     ).snapshotItem(0);
    ...                   e=document.createEvent("Event");
    ...                   e.initEvent('tap',true,false);
    ...                   el.dispatchEvent(e);

If someone has the same problem, this should work.