Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please Help - Auto-Login
#2
You are not getting the form,so it return None.
>>> form = None
>>> form['something'] = '****'
Error:
Traceback (most recent call last):   File "<string>", line 301, in runcode   File "<interactive input>", line 1, in <module> TypeError: 'NoneType' object does not support item assignment
The problem here is that log in use JavaScripts here with AngularJS.
RoboBrowser dos not evaluate JavaScript,so then have to reverse engineering what Angular dos to do the same.
Or simpler use Selenium/PhantomJS to do this.
Example it will try to log in:
from selenium import webdriver
from bs4 import BeautifulSoup
import time
 
# Activate Phantom and deactivate Chrome to not load browser
#browser = webdriver.PhantomJS()
browser = webdriver.Chrome()
web_url = 'https://m.onlinebrokerage.cibc.com/#/signOn/en/ie'
browser.get(web_url)
user_name = browser.find_element_by_xpath('//input[@ng-model="pageState.username.value"]')
user_name.send_keys("Foo")
password = browser.find_element_by_xpath('//input[@ng-model="pageState.password.value"]')
password.send_keys("Bar")
time.sleep(2)
submit = browser.find_element_by_css_selector('#submitButton')
submit.click()

''' 
# Give source code to BeautifulSoup
soup = BeautifulSoup(browser.page_source, 'lxml')
welcome = soup.select('//title')
print(welcome.text)
'''
Reply


Messages In This Thread
Please Help - Auto-Login - by shiny - Oct-20-2017, 07:21 AM
RE: Please Help - Auto-Login - by snippsat - Oct-20-2017, 02:57 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020