[Tutor] How can I run this test script using selenium while making connection and running the code I am facing issue Please see my code below

Alan Gauld alan.gauld at yahoo.co.uk
Thu Jan 19 05:43:27 EST 2017

On 19/01/17 02:29, Sarika Shrivastava wrote:
> Yes I dont have issue with unittest framework but i dont have to reconized
> my issue How can I resolve this issue ??

What is the issue? You haven't told us what is wrong.
What happens? What did you expect to happen?
Are there any error messages? If so post them so we can see.

Since the code you have posted does virtually nothing it's
hard to guess what might be going wrong.

> So I need to use splinter???

Probably not, since splinter is built on top of selenium.
But it might be slightly easier to use - I don't know since
I've never heard of it before.

>>>> import unittest
>>>> from selenium import webdriver
>>>> from selenium.webdriver.common.keys import Keys
>>>> import time
>>>> class PythonOrgSearch(unittest.TestCase):
>>>>     def setUp(self):
>>>>         self.driver =
>>>> webdriver.Chrome('C:\Users\uidk9685\Downloads\chromedriver.exe')
>>>>         # print self.driver
>>>>         time.sleep(0.5)
>>>>     def test_search_in_python_org(self):
>>>>         driver = self.driver

This line doesn't do much, it only saves you typing 'self.' twice
in the commented code.

>>>>         # driver.get("http://www.python.org")
>>>>         # self.assertIn("Python", driver.title)
>>>>         # elem = driver.find_element_by_name("q")
>>>>         # elem.send_keys("pycon")
>>>>         # elem.send_keys(Keys.RETURN)
>>>>         # assert "No results found." not in driver.page_source
>>>>     def tearDown(self):
>>>>         pass
>>>>         # self.driver.close()
>>>> if __name__ == "__main__":
>>>>     unittest.main()

>>>> [image: Inline image 2]

I'm not sure if this image was relevant or not but as
a text based list images often get stripped by the
server... If there was useful information in it you
will need to describe it or, if it was textual,
paste it into the body

Finally, selenium is a bit off-topic for this list
since it's not part of the core library or language.
You might get a better response on the selenium
support forum.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list