How to skip “Welcome Page” in Chrome using adb

自闭症网瘾萝莉.ら 提交于 2020-03-18 12:38:31

问题


I am trying to open a URL in Google Chrome using adb command line. Have set "--no-first-run" using following command -

adb shell 'echo "chrome --no-first-run" > /data/local/tmp/chrome-command-line'

Have taken the command line switch from the following website - http://peter.sh/experiments/chromium-command-line-switches/

Then I execute the following commands,

adb -s TA99300UFC shell am set-debug-app com.android.chrome
adb -s TA99300UFC shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d 'http://wikipedia.org'

Still the "Welcome Page" shows up.

How can I skip this and go directly to the website URL passed in command?


回答1:


The problem was solved after the --persistent flag was added in the set-debug-app command.

So the command changed to adb -s TA99300UFC shell am set-debug-app --persistent com.android.chrome. After that chrome://version displayed chrome --display-fre under the Command line section.




回答2:


adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'

this command disables the welcome screen for chrome




回答3:


I stumbled upon this question when I was trying to somehow skip the welcome page. I finally managed to do so by using following code:

String context = driver.getContext(); // = "CHROMIUM"
driver.context("NATIVE_APP");
driver.findElement(By.id("com.android.chrome:id/terms_accept")).click();
driver.findElement(By.id("com.android.chrome:id/negative_button")).click();
driver.context(context);

You have to switch into the context "NATIVE_APP" before you can click any buttons in Chrome that do not belong to a web page but rather belong to Chrome itself. Afterward you have to switch back out again by callling driver.context(context).

Hopefully I solved somebody's problem who also stumbled upon this page via Google.



来源:https://stackoverflow.com/questions/33408138/how-to-skip-welcome-page-in-chrome-using-adb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!