I am trying to pull the data from websites. So I want to select 3 drop-down values in below URL but i cant change those values. example i want to select month ]CopyThat is:ie.document.querySelector("#fmonth1 option[value='1']")
CopyYou may need .Click on the end for selected. Can't test that url but also try:ie.document.querySelector("#fmonth1 option[value='1']").Selected = TrueCopyMore generally, if you know an element exists, and your syntax is correct, but you are still getting not set then it may be a timing issue where you need a longer wait (e.g. timed loop) before attempting to access, e.g.Const MAX_WAIT_SEC AsLong = 10Dim t AsDate, ele AsObject
t = Timer
Do
DoEvents
OnErrorResumeNextSet ele = ie.document.querySelector("#fmonth1")
OnErrorGoTo0If Timer - t > MAX_WAIT_SEC ThenExitDoLoopWhile ele IsNothingIfNot ele IsNothingThen
ele.Click 'may be needed to expose options
ie.document.querySelector("#fmonth1 option[value='1']").Selected = TrueEndIfCopy If inside of a parent iframe/frame you will need to navigate that first e.g.ie.document.getElementsByTagName("iframe")(0).contentDocument.querySelector("#fmonth1 option[value='1']").Selected = TrueCopy I tested the following now I can access the page:Public Sub MakeSelection()
Dim ie AsNew InternetExplorer
With ie
.Visible = True
.navigate "https://www.bseindia.com/markets/debt/BhavCopyDebt.aspx?expandable=6"While .Busy Or .readyState < 4: DoEvents: Wend
.document.getElementsByTagName("iframe")(0).contentDocument.querySelector("#fmonth1 option[value='1']").Selected = True
Stop '<==Delete me later
.Quit
End With
End Sub
Copy
Share
Post a Comment
for "Object Variable Or With Block Variable Not Set Getelementsbyname Vba"
Top Question
WebRTC Video Constraints Not Working
I'm trying to get a lower resolution from the webcam na…
Remove Content From Table And Reformat The Table
I want to do My page is displaying data of the table in be…
HTML Table With Fixed Header And Fixed Leading Columns With Knockout Controls In The Header And First Column
I have a HTML table which can be customized by the user: E…
How Do I Make A Menu Pop Up When The User Clicks The Menu Button?
I'm new to web development and I dont have much experie…
Position This Div In The Center Of It's Container?
Before you attempt to solve this please carefully read the …
ASP.NET MVC 3 - DropDownListFor Fails When URL Parameter Also Exists With Same Name As View Model Parameter
I am not sure if this is a bug with the DropDownListFor ext…
What Is The Correct Way For Redirecting From The Domain Name Itself To A Page In A Directory?
I want anyone browsing for 'MyDomain.com' to see wh…
Disable Browser Caching Html5
I would like to know how to disable the browser cache, usin…
How Can I Display Bold Text In A Textarea?
I have this code: test It displays the raw HTML code. Ins…
Bs4 Breaks Html Trying To Repair It
BS4 corrects faulty html. Usually this is not a problem. I …
December 2024
(1)
November 2024
(37)
October 2024
(62)
September 2024
(21)
August 2024
(361)
July 2024
(333)
June 2024
(698)
May 2024
(1287)
April 2024
(812)
March 2024
(1552)
February 2024
(1709)
January 2024
(1382)
December 2023
(1399)
November 2023
(447)
October 2023
(585)
September 2023
(294)
August 2023
(334)
July 2023
(265)
June 2023
(330)
May 2023
(206)
April 2023
(150)
March 2023
(139)
February 2023
(168)
January 2023
(259)
December 2022
(130)
November 2022
(229)
October 2022
(178)
September 2022
(159)
August 2022
(289)
July 2022
(105)
Menu Halaman Statis
Beranda
© 2022 - Html5 Coding