Based on the suggestion of Vince and this web page:
http://webdata-scraping.com/login-website-programmatically-using-c-web-scraping/ you can do the following in .Net:
Code: Select all
url←'https://www.schwab.com/'
⎕USING←'System.Windows.Forms,System.Windows.Forms.dll'
⎕USING,←⊂'System.Drawing,System.Drawing.dll'
wb←⎕NEW WebBrowser
wb.Dock←wb.Dock.Fill
wb.Navigate(⊂url)
⎕DL 5
htmlDoc←wb.Document
html←⎕UCS wb.DocumentStream.ToArray
signonAcc←htmlDoc.GetElementById(⊂'SignonAccountNumber')
⍝ signonAcc.InnerText←'user_id' ⍝ No error but property is not changed
signonAcc.InnerHtml←'user_id'
signonPwd←htmlDoc.GetElementById(⊂'SignonPassword')
⍝ signonPwd.InnerText←'password' ⍝ No error but property is not changed
signonPwd.InnerHtml←'password'
loginBtn←htmlDoc.GetElementById(⊂'&lid=Log in')
loginBtn.InvokeMember(⊂'click')
⍝ Show the WebBrowser in a WindowsForm
fm←⎕NEW Form
fm.Size←⎕NEW Size(1100,680)
fm.Text←'URL [ ',url,' ]'
fm.onClosed←'_GetWebResults_onClosed'
fm.Controls.Add wb
fm.Show ⍬
and for the onClosed event function:
Code: Select all
_GetWebResults_onClosed(sender event)
(⌷sender.Controls).Dispose
This is working code that is not bugging but you will have to try it with your ID and Password. 'htmlDoc' is a
System.Windows.Forms.HtmlDocument that you can interrogate easily with
.GetElementById or
.GetElementsByTagName . You find those ID and TagName by inspecting manually the html of the page or if you use Safari you can right click on an element of the page and on the contextual menu you choose 'Inspect Element' and it will show you the HTML of that element and finds its ID more easily. Sometimes you may need to put ⌷ or ⍬⍴⌷ in front of the result of
.GetElementById or
.GetElementsByTagName to get it in the proper rank.
Good luck.