title: Flask with python selenium
body: <p>When i run my first file newone.py at that time flask server is open and the i press one button and my second file test.py is call and run my function script and test my website testing are complete successful but one file is generated .html but its give null value when i run on flask server its give me this kind of output please give me solution for this</p>
  
  <pre><code>this is my main file which name is newone.py
  
  from flask import Flask, render_template
  from test import test
  from unittest import TestCase
  import unittest
  from unittest import TestCase
  import HTMLTestRunner
  from flask import request
  
  app=Flask(__name__)
  
  
  @app.route('/submit')
  def test2():
              return test.testlogin()
  
  @app.route('/view')
  def test3():
      return render_template("no.html")
  
  
  @app.route('/')
  def test1():
              return render_template('profile.html')
  
  
  
  if __name__ == "__main__":
      app.run(threaded=False)
      HTMLTestRunner.main()
  
  
  
   and my another file is test.py in this  main function are calling by main file
  
  import unittest
  from random import randint
  from flask import Flask, render_template
  from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  import time
  from unittest import TestCase, main as unittest_main
  import MySQLdb
  import HTMLTestRunner
  
  
  
  class test(unittest.TestCase):
  
      @classmethod
      def testlogin(self):
  
          # if request.method:'POST'()
          browser = webdriver.Chrome()
          db = MySQLdb.connect("127.0.0.1", "root", "", "first")
          cursor = db.cursor()
          cursor.execute("select * from login WHERE id = 1")
          results = cursor.fetchall()
          error="in"
          # total_records = len(results)
          # random_id = randint(1,total_records)
          # print(random_id)
          #
          # cursor.execute("SELECT * FROM login WHERE id = %s" % random_id)
          # results = cursor.fetchall()
  
          if (results):
  
              for row in results:
                  data = row
                  print("data[0] is : ", data[0])
                  print("data[1] is : ", data[1])
                  print("data[2] is : ", data[2])
                  # browser = self.browser
                  browser.get("http://itechnotion.in/redonno/php/giver/giver/login")
                  user = browser.find_element_by_css_selector('#txt_church_email')
                  user.send_keys(data[1])
                  password = browser.find_element_by_css_selector('#txt_church_password')
                  password.send_keys(data[2])
                  login = browser.find_element_by_css_selector('button')
                  login.click()
                  browser.close()
                  return "ff"
          else:
              assert "No results found." not in browser.page_source
  
  
  if __name__ == "main":
      HTMLTestRunner.main
  </code></pre>