私のサインアップ プロセスは、ネイティブ コードではなく、WebView で Cookie を生成します。すべてのテストは Webview から取得した Cookie に依存しているため、Robotium テスト内で Webview からデータを抽出する方法が必要です。これはどのように行うことができますか?ここに私の WebView フラグメントがあります:
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);
// ######## I need to pull these Cookies out here in the Robotium test. How do I use Solo etc to do this?
}
}
}
}
適切な時点で Cookie の値を取り出し、残りのテストで使用できるように保存する Robotium テストを作成する方法を知る必要があります。これを機能させる必要があります。そうしないと、他のテストが実行されません。ありがとう