Learning Appium, encountering a new session could not being created. Problem
Paste_image.png Question one:
The first Test application for the mobile phone system comes with the calculator application, the test encountered the above problems, found a lot of information, and finally found that the problem lies:
@BeforeClass public void Setup () throws Exception {desiredcapabilities cap = new Desiredcapabilities (); Cap.setcapability (Capabilitytype.browser_name, ""); Cap.setcapability ("PlatformName", "Android"); Cap.setcapability ("DeviceName", "71mbblg26r76"); Cap.setcapability ("Platformversion", "5.1"); This specifies the package name and the specific activity cap.setcapability ("Apppackage", "Com.meizu.flyme.calculator"); Cap.setcapability ("Appactivity", "Com.meizu.flyme.calculator.Calculator"); #重点所在 (Resolve session Cannot create problem)//////////////////////////////////////////////////////////////////cap.setcapability ( "Appwaitactivity", "Com.meizu.flyme.calculator.Calculator"); You want to wait for the startup activity name Cap.setcapability ("Sessionoverride", true); Overwrite session at each boot, otherwise the second run will be an error. Cannot create a new session///////////////////////////////////////////////////////////////////// Driver = new Androiddriver (New URL ("Http://127.0.0.1:4723/wd/hub"), cap); }
Solution One:
We just need to add the two lines of code listed above when we configure the APK to solve the problem.
Question two:
The above test object is the mobile phone system with the application, but I do not know that some of the application of the page is not to be used by other applications, testing again I fell out of the hole again-the above problem, A new session could not be created.
Solution Two:
Programme says:
is related to the Androidmanifest.xml configuration file, immediately Baidu this configuration file exactly what the role is. Finally, find the Android developer in the Androidmanifest.xml profile, added at main activity and intent entrance: android:exported= "true"
Paste_image.png
Problem solved immediately, finally can launch the app!
I am a small white, if there is a problem, a lot of advice.
by Xiao Jie
Links: http://www.jianshu.com/p/9f8a7d5b5166
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Appium problems encountered