{"id":1872,"date":"2014-10-23T01:04:03","date_gmt":"2014-10-23T05:04:03","guid":{"rendered":"http:\/\/qxf2.com\/blog\/?p=1872"},"modified":"2017-07-06T14:52:18","modified_gmt":"2017-07-06T18:52:18","slug":"appwaitactivity-new-session-could-not-be-created","status":"publish","type":"post","link":"https:\/\/qxf2.com\/blog\/appwaitactivity-new-session-could-not-be-created\/","title":{"rendered":"appWaitActivity: A new session could not be created"},"content":{"rendered":"<p>While exploring <a href=\"https:\/\/qxf2.com\/blog\/appium-tutorial-python-physical-device\/\">Appium with mobile devices <\/a> I hit the following error<\/p>\n<div style=\"background-color: #ffff99;\">\n<strong>WebDriverException: Message: u&#8217;A new session could not be created. (Original error: atpwta.live\/.activity.Main never started. Current: atpwta.live\/.activity.root.TournamentList)&#8217;<\/strong>\n<\/div>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2014\/10\/activity_error.gif\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2014\/10\/activity_error-300x181.gif\" alt=\"activity_error\" width=\"300\" height=\"181\" class=\"aligncenter size-medium wp-image-1885\" \/><\/a><\/p>\n<p>Initially, I had set desired capabilities to:<\/p>\n<pre lang=\"python\">\r\ndesired_caps['platformName'] = 'Android'\r\ndesired_caps['platformVersion'] = '4.4'\r\ndesired_caps['deviceName'] = 'Moto E'\r\ndesired_caps['appPackage'] = 'atpwta.live'\r\ndesired_caps['appActivity'] = '.activity.Main'  \r\n<\/pre>\n<p>After reading the <a href=\"http:\/\/appium.io\/slate\/en\/master\/?python#appium-server-capabilities\">appium docs<\/a> I solved the issue by adding the following line.<\/p>\n<pre lang=\"python\">\r\ndesired_caps['appWaitActivity']= '.activity.root.TournamentList'\r\n<\/pre>\n<p>This time the test run was successful.<br \/>\n<a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2014\/10\/activity_run.gif\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2014\/10\/activity_run-300x191.gif\" alt=\"activity_run\" width=\"300\" height=\"191\" class=\"aligncenter size-medium wp-image-1886\" \/><\/a><\/p>\n<h3>So why did appWaitActivity help?<\/h3>\n<p>A simplified (but technically incorrect) way of understanding this error is that <a href=\"http:\/\/appium.io\/\">Appium<\/a> was waiting for a screen name <code>.activity.Main<\/code> and timed out. The error helpfully tells you the current active screen is <code>.activity.root.TournamentList<\/code>. The desired capability <\/strong>appWaitActivity<\/strong> tells Appium what <a href=\"http:\/\/developer.android.com\/guide\/components\/activities.html\">Android activity<\/a> it should wait for. If you see a similar error, set your appWaitActivity to match the current activity in the error message.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>While exploring Appium with mobile devices I hit the following error WebDriverException: Message: u&#8217;A new session could not be created. (Original error: atpwta.live\/.activity.Main never started. Current: atpwta.live\/.activity.root.TournamentList)&#8217; Initially, I had set desired capabilities to: desired_caps[&#8216;platformName&#8217;] = &#8216;Android&#8217; desired_caps[&#8216;platformVersion&#8217;] = &#8216;4.4&#8217; desired_caps[&#8216;deviceName&#8217;] = &#8216;Moto E&#8217; desired_caps[&#8216;appPackage&#8217;] = &#8216;atpwta.live&#8217; desired_caps[&#8216;appActivity&#8217;] = &#8216;.activity.Main&#8217; After reading the appium docs I solved the issue by [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50,15,71],"tags":[],"class_list":["post-1872","post","type-post","status-publish","format-standard","hentry","category-appium","category-how-to","category-mobile-automation"],"_links":{"self":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/1872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/comments?post=1872"}],"version-history":[{"count":19,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/1872\/revisions"}],"predecessor-version":[{"id":6390,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/1872\/revisions\/6390"}],"wp:attachment":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/media?parent=1872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/categories?post=1872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/tags?post=1872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}