|
-
Aug 22nd, 2012, 08:24 PM
#1
Thread Starter
New Member
How to access the elements in a aspx page hold by the webbrowser control
Hi, Everyone:
I am new to vb and this forums. What I am trying to do is to write an automation program for our sales. The program needs to auto login to our customer's web site, then go a aspx page to get a sales table from customer's database. I am using a webbrowser control navigate to the customer site, and was able to automatically login and jump to the aspx page directly. I can see the web page in the webbrowser control window and the code in the code window. But when I trying to access its elements. that is trying to assign value of the element in order to extract certain data from the database, somehow I failed. The error message said there is no object exist, so the value is NULL. I am not quite understand this?
Can anyone point me a direction? Or give me some example of how to access the elements in a aspx page.
Thanks a lot.
-
Aug 26th, 2012, 01:37 AM
#2
Re: How to access the elements in a aspx page hold by the webbrowser control
Welcome to the forums jchi1207 
Are you doing this in asp.net or some other language?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Aug 26th, 2012, 09:45 AM
#3
Re: How to access the elements in a aspx page hold by the webbrowser control
Looks like plain old Web scraping to me. Probably belongs in one of the programming language forums but I guess we can't tell which.
The whole description smells a lttle funny though. To sell to customers you scrape data from their sites? Hopefully this isn't just spelunking these customers' contact info for spamming purposes.
-
Aug 26th, 2012, 07:25 PM
#4
Thread Starter
New Member
Re: How to access the elements in a aspx page hold by the webbrowser control
 Originally Posted by koolsid
Welcome to the forums jchi1207
Are you doing this in asp.net or some other language?
Hi, Koolsid:
Thanks for the reply. I am doing this in VB 2010 express. I was able to auto login to this web site, and directly jump to the inquiry form (for the sales data). But somehow I could not access the elements in the page. If I use manual process, I will first login to the website, then select the menu item twice to enter the inquiry form. After log in to the web site, the page actually is composed by 3 frames. (the inquiry form is one of the page frame). What I am doing is directly jump to the page display only the inquiry form.
Hope you guys can help me. I am quite new to the web programming.
-
Aug 26th, 2012, 10:48 PM
#5
Thread Starter
New Member
Re: How to access the elements in a aspx page hold by the webbrowser control
I tried some new method last week, and now I could not even jump to the frame page anymore. Maybe I should sates what I had done to clear this issue.
I first use webBrowser navigagte to the customer's website,
Then do the auto login
Me.wbTest.Document.GetElementById("txtUSER_ID").InnerText = "myid"
Me.wbTest.Document.GetElementById("txtUSER_PASSWORD").InnerText = "mypassword"
Me.wbTest.Document.GetElementById("tb_CheckDA").InnerText = validation code
Me.wbTest.Document.GetElementById("btnOK").InvokeMember("click")
Me.wbTest.Document.Window.DomWindow.execscript(_doPostBack())
Although VB issue me an error saying this javascript was protected, but still I was able to jump to the data request form.
This form was composed by 3 frames, top.aspx, home.aspx, and menu.aspx
when I click the option from the menu.aspx frame, it will post the data request form in home.aspx frame's area.
I garbed the URL from the menu.aspx page, and was able to navigate to the request form in a web browser.
But when I did the same in my program to ask the webbrowser to navigate to that URL, it back into the login page.
( https://b2b.tk3c.com.tw/tk3cb2b/B2BC...ProdNM=Nothing)
Can anyone tell me why? And how can I navigate to the data request frame page and access its input elements to automate the process?
-
Sep 1st, 2012, 11:50 PM
#6
Re: How to access the elements in a aspx page hold by the webbrowser control
 Originally Posted by jchi1207
Hi, Koolsid:
Thanks for the reply. I am doing this in VB 2010 express.
Moved to Visual Basic .NET from General Developer Forum
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|