0

I am using selenium and i have properly installed the selenium module on redhat linux 6. Below is my script:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time, re
import zlib


class Sele1(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "https://bugzilla.example.com/"
        self.verificationErrors = []

    def test_sele1(self):
        driver = self.driver
        driver.get(self.base_url + "/")
        driver.find_element_by_id("Bugzilla_login").clear()
        driver.find_element_by_id("Bugzilla_login").send_keys("username")
        driver.find_element_by_id("Bugzilla_password").clear()
        driver.find_element_by_id("Bugzilla_password").send_keys("password")
        driver.find_element_by_id("log_in").click()
        driver.find_element_by_id("quicksearch").clear()
        driver.find_element_by_id("quicksearch").send_keys("new bugs is bugzilla tool")
        driver.find_element_by_xpath("//input[@value='Find Bugs']").click()

    def is_element_present(self, how, what):
        try: self.driver.find_element(by=how, value=what)
        except NoSuchElementException, e: return False
        return True

    def tearDown(self):
        self.driver.quit()
        self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":
    unittest.main()

When i am running this script it is showing errors:

ERROR: test_sele1 (main.Sele1)

Traceback (most recent call last): File "sele1.py", line 19, in test_sele1 driver.find_element_by_id("Bugzilla_login").clear() AttributeError: 'NoneType' object has no attribute 'clear'


Ran 1 test in 2.018s

FAILED (errors=1)

Plateform: Redhat Python Version: 2.6

Note: while running the same script in windows7, it is running fine but not running in linux with python2.6

Please help me for this... Thanks in advance!

4

1 に答える 1