I have a simple python code which will mock events in Firefox browser. Currently I am testing the pythonanywhere environment, I have made a virtual environment and have install all the required Python libraries. I have uploaded the sample code when I run the same code on the console, it runs fine but when I put it in a webapp it is not working. It's giving The browser appears to have exited " 2017-02-23 07:05:41,153 :selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details. error in the logs. I think its because of the firefox version or anything. Please help!
@app.route('/webapp/<name>/<searchVal>')
def defi(name,searchVal):
if "2" in name:
display = Display(visible=0, size=(800, 600))
time.sleep(5)
display.start()
try:
time.sleep(5)
browser = webdriver.Firefox()
browser.get('http://www.google.com')
finally:
m = {'Site': 'Test site', 'searchVal': browser.title}
browser.quit()
display.stop()
return json.dumps(m)
if __name__ == "__main__":
app.run()