我可以用Robotium启动Android浏览器吗?
我是新来的机器人。我正在尝试用Robotium启动Android浏览器。谢谢 您可以这样做:我可以用Robotium启动Android浏览器吗?,android,robotium,Android,Robotium,我是新来的机器人。我正在尝试用Robotium启动Android浏览器。谢谢 您可以这样做: Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getInstrumentation().getContext().startActivity(i); 但是,它将打开另一个应用程序,您将无法使用robotiu
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getInstrumentation().getContext().startActivity(i);
但是,它将打开另一个应用程序,您将无法使用robotium执行任何其他操作
Robotium can be used for accessing views inside the application. Since browser is another application you cannot access it.
Only you can just launch a browser using the following code
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
Context instrumentationContext=getInstrumentation().getContext();
instrumentationContext.startActivity(browserIntent);