Web-Scraping Selecting Dropdownlist in website

Hasegawa

New Member
Joined
Oct 31, 2018
Messages
10
After button element "ContentPlaceHolder2_btnSearch" is click, element "cbSite_I" returns to blank. I want element "cbSite_I" to have value "Cát Lái" after element "ContentPlaceHolder2_btnSearch" is click. Pls kindly help me accordingly. Thanks.

Visible Text on websit :
Button : "Search"
elements("cbSite_I") : "Container delivery area" Box.
elements("txtItemNo_I") : "Container (*)" Box


Code:
Sub Web()
 
Dim IE As New SHDocVw.InternetExplorer
 
On Error GoTo Errorcatch
Application.ScreenUpdating = False
 
IE.Visible = True
 
IE.Navigate "https://eport.saigonnewport.com.vn/Pages/Common/Containers_new"
 
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy
DoEvents
Loop
 
'Application.Wait Now + TimeSerial(0, 0, 5)
 
IE.document.forms("form2").elements("cbSite_I").Value = "Cát Lái"
IE.document.forms("form2").elements("txtItemNo_I").Value = "MSKU1183832"
IE.document.forms("form2").elements("ContentPlaceHolder2_btnSearch").Click
 
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy
DoEvents
Loop
 
'Application.Wait Now + TimeSerial(0, 0, 5)
 
Range("A2").Value = IE.document.getElementById("grdContainer_DXDataRow0").Children(17).textContent
 
 
Set IE = Nothing
IE.Quit
 
Exit Sub
Errorcatch:
MsgBox Err.Description
Set IE = Nothing
IE.Quit
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top