stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Preventing SessionNotCreatedError in WebDriver when using Appium

    Example error (for test using Appium with Selenium WebDriver and Rspec) when a previous test was aborted before a clean exit:

    Failures:
    
      1) The APPNAME app displays SCREEN when user selects OPTION
      Failure/Error: driver =
      Appium::Driver.new(options).start_driver
    
         Selenium::WebDriver::Error::SessionNotCreatedError:
           Requested a new session but one was in progress
         # ./spec/spec_helper.rb:20:in `block (2 levels)
           in <top (required)>'
    
    Finished in 0.06314 seconds
    (files took 0.73578 seconds to load)
    1 example, 1 failure
    

    To prevent this error in subsequent test runs:

    1. Stop the Appium server if it is running
    2. In Appium, go to Preferences
    3. Select General
    4. Check the Override Existing Sessions checkbox
    5. Start the Appium server