android - Robotium Test to Extract Cookies from WebView -
my sign process produces cookies in webview, not in native code. tests depend on cookies retrieved webview need way extract data webview inside robotium test. how can done? here webview fragment:
public class mywebviewfragment extends fragment { private cookiemanager cookiemanager; @viewbyid webview mywebview; @afterviews void theafterviews() { mywebview.getsettings().setjavascriptenabled(true); mywebview.getsettings().setdomstorageenabled(true); cookiesyncmanager.createinstance(getactivity()); cookiemanager = cookiemanager.getinstance(); mywebview.loadurl(theurl); mywebview.setwebviewclient(new webviewclient() { public void onpagestarted(webview view, string url, bitmap favicon) { if ((url != null) && (url.equals(theurl))) { string thecookies = cookiemanager.getcookie(url); // ######## need pull these cookies out here in robotium test. how use solo etc this? } } }
}
i need know how write robotium test @ right point pull out values of cookies , save rest of tests use. need thiw working or none of other tests run. thanks
the simple answer think may know having seen other questions hold of fragment , ask fragment value. potentially might consider mocking functionality out tests or allow tests method able set cookies etc (not sure if feasible case or not.)
Comments
Post a Comment