Writing a script in vba using selenium for the purpose of switching iframe when I run it, I get an error: object doesn\'t support this property. How can I do it if I take the be
little extra good functionality added to your code
btw .. the cells(1,1) line fails
Sub HCAD()
' add ref: Selenium Type Library
Dim driver As New ChromeDriver ' PhantomJSDriver (this one is for "headless" browsing)
driver.Get "https://public.hcad.org/records/quicksearch.asp"
driver.Wait 500
driver.FindElementById("s_addr").Click
driver.FindElementByName("stnum").SendKeys ("8227")
driver.FindElementByName("stname").SendKeys ("FINDLAY ST")
driver.FindElementByXPath("//input[@value='Search']").Click
driver.Wait 1000
Dim bbb As Object
Set bbb = driver.TakeScreenshot
bbb.ToExcel Cells(5, 1)
Set bbb = Nothing
Cells(1, 1) = driver.FindElementByXPath("/html/body/table/tbody/tr/td/table[5]/tbody/tr[2]/td[1]/table/tbody/tr/th").Text
Set driver = Nothing
End Sub
According to the suggestion given by @Mathieu Guindon, the solution should be like below (working one).
Sub HandleIframe()
With New ChromeDriver
.get "http://hcad.org/quick-search/"
.SwitchToFrame .FindElementByTag("iframe", timeout:=10000)
.FindElementById("acct").SendKeys "8227"
.FindElementByCss("input[value='Search']").Click
End With
End Sub