-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRediff.py
42 lines (34 loc) · 1.33 KB
/
Rediff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
URL = "http://money.rediff.com/"
locators = {"searchbox": "//*[@id='srchword']",
"quotebutton": "//*[contains(@class,'btn_srch')]",
"pageready": "//span[contains(@class, 'moneywizlogo')]",
"req_company": "//*[@id='for_BSE']/h1"
}
company_name = "JK Cement Ltd."
class Test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testRediffmoney(self):
driver = webdriver.Firefox()
driver.get(URL + "gainers/bse")
driver.implicitly_wait(10)
webpagename = driver.find_element_by_xpath(locators['pageready'])
print "webpage is " + webpagename.text
#assert webpagename.text == "Rediff Moneywiz"
element = driver.find_element_by_xpath(locators['searchbox'])
driver.implicitly_wait(10)
element.send_keys("JK Cement Ltd.")
element.send_keys(Keys.RETURN)
driver.implicitly_wait(10)
company = driver.find_element_by_xpath(locators['req_company'])
print "Current company is " + company.text
assert company_name in company.text
print "edited from eclipse"
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testRediffmoney']
unittest.main()