Advertisement
Guest User

Untitled

a guest
Dec 7th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1. ## Attempting to login to Mijn ING Zakelijk, please wait.
  2. - Starting the browser..
  3. - Visiting the url..
  4. - Filling the username form with the defined username..
  5. - Filling the password form with the defined password..
  6. - Clicking the submit button..
  7. Traceback (most recent call last):
  8. File "/Users/narekaramjan/Dropbox/Python/Test environment 2.7.3/Splinter.py", line 98, in <module>
  9. mijning()
  10. File "/Users/narekaramjan/Dropbox/Python/Test environment 2.7.3/Splinter.py", line 27, in mijning
  11. attemptLogin(url2, username2, password2, defined_title2, website_name2, browser_type2)
  12. File "/Users/narekaramjan/Dropbox/Python/Test environment 2.7.3/Splinter.py", line 71, in attemptLogin
  13. browser.find_by_css('.submit').first.click()
  14. File "/Users/narekaramjan/Library/Python/2.7/lib/python/site-packages/splinter/driver/webdriver/__init__.py", line 344, in click
  15. self._element.click()
  16. File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 54, in click
  17. self._execute(Command.CLICK_ELEMENT)
  18. File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 228, in _execute
  19. return self._parent.execute(command, params)
  20. File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 165, in execute
  21. self.error_handler.check_response(response)
  22. File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 158, in check_response
  23. raise exception_class(message, screen, stacktrace)
  24. selenium.common.exceptions.WebDriverException: Message: u'Error Message => 'Click succeeded but Load Failed. Status: 'fail''n caused by Request => {"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"81","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:56899","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","method":"POST","post":"{\"sessionId\": \"c2bbc8a0-e3d2-11e2-b7a8-f765797dc4e7\", \"id\": \":wdc:1372850513087\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/c2bbc8a0-e3d2-11e2-b7a8-f765797dc4e7/element/%3Awdc%3A1372850513087/click"}' ; Screenshot: available via screen
  25.  
  26. Process finished with exit code 1
  27.  
  28. ## *** Payment Notification and Mail Tool (FPNMT) ##
  29. from splinter import *
  30. from Tkinter import *
  31.  
  32. def ###():
  33.  
  34. # Define values
  35. browser_type1 = 'phantomjs' # 'phantomjs' or 'firefox'
  36. url1 = 'http://###.nl/admin'
  37. username1 = '###'
  38. password1 = '###'
  39. defined_title1 = 'Bestellingen'
  40. website_name1 = '###.nl Admin'
  41.  
  42. attemptLogin(url1, username1, password1, defined_title1, website_name1, browser_type1)
  43.  
  44. def mijning():
  45.  
  46. # Define values
  47. browser_type2 = 'phantomjs' # 'phantomjs' or 'firefox'
  48. url2 = 'https://mijnzakelijk.ing.nl/internetbankieren/SesamLoginServlet'
  49. username2 = '###'
  50. password2 = '###'
  51. defined_title2 = 'Saldo informatie'
  52. website_name2 = 'Mijn ING Zakelijk'
  53.  
  54. attemptLogin(url2, username2, password2, defined_title2, website_name2, browser_type2)
  55.  
  56. # Functions #
  57. def attemptLogin(url, username, password, defined_title, website_name, browser_type):
  58. print '## Attempting to login to ' + website_name + ', please wait.'
  59.  
  60. # Start the browser
  61. print '- Starting the browser..'
  62. browser = Browser(browser_type)
  63.  
  64. # Visit in the url
  65. print '- Visiting the url..'
  66. browser.visit(url)
  67.  
  68. if website_name == '###.nl Admin':
  69. # Find the username form and fill it with the defined username
  70. print '- Filling the username form with the defined username..'
  71. browser.fill('username', username)
  72.  
  73. # Find the password form and fill it with the defined password
  74. print '- Filling the password form with the defined password..'
  75. browser.fill('password', password)
  76.  
  77. # Find the submit button and click
  78. print '- Clicking the submit button..'
  79. browser.click_link_by_text('Inloggen')
  80.  
  81. # Find, click and display page with order history
  82. print '- Visiting the defined web page..'
  83. current_token = browser.url[57:97]
  84. url_plus_token = 'http://www.###.nl/admin/index.php?route=sale/order' + current_token
  85. browser.visit(url_plus_token)
  86.  
  87. else:
  88. website_name == 'Mijn ING Zakelijk'
  89. # Find the username form and fill it with the defined username
  90. print '- Filling the username form with the defined username..'
  91. browser.find_by_id('gebruikersnaam').first.find_by_tag('input').fill(username)
  92.  
  93. # Find the password form and fill it with the defined password
  94. print '- Filling the password form with the defined password..'
  95. browser.find_by_id('wachtwoord').first.find_by_tag('input').fill(password)
  96.  
  97. # Find the submit button and click
  98. print '- Clicking the submit button..'
  99. browser.find_by_css('.submit').first.click()
  100.  
  101. # Display page with transaction history
  102. print '- Visiting the defined web page..'
  103. browser.visit('https://mijnzakelijk.ing.nl/mpz/solstartpaginarekeninginfo.do')
  104.  
  105. # Get page title after successful login
  106. current_title = browser.title
  107.  
  108. # Check the title of the page to confirm successful login
  109. checkLogin(defined_title, current_title, website_name, browser)
  110.  
  111. def checkLogin(defined_title, current_title, website_name, browser):
  112. if current_title == defined_title:
  113. print '# Login to', website_name, 'successful.'
  114. print '- Quitting the browser..'
  115. browser.quit()
  116.  
  117. else:
  118. print '# Login to', website_name, 'failed.'
  119. print '- Quitting the browser..'
  120. browser.quit()
  121.  
  122. i = 1
  123. while i < 10:
  124. print i
  125. #***()
  126. mijning()
  127. i = i+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement