Home > Enterprise >  Cannot Accept cookies with SeleniumBasic on ibm website
Cannot Accept cookies with SeleniumBasic on ibm website

Time:11-10

I have a VBA code that enters enter image description here

I tried to click on accept button by Xpath but I get error.

enter image description here

I even tried to wait until it fully loads, but still no success.

Here is my attempt:

Dim driver
Set driver = CreateObject("Selenium.EdgeDriver")

With driver
    .start
    .get "https://ibm.com"
    .FindElementByXPath("/html/body/div[8]/div[1]/div/div[3]/a[1]").Click
    .Quit
End With

I have found something about to switch to frame but I do not know how to perform.

CodePudding user response:

your button is inside a frame, so you could something like this:

Sub CloseConsent()
    With New ChromeDriver
        .get "http://hcad.org/quick-search/"
        .SwitchToFrame .FindElementByXPath("//iframe[@class='truste_popframe']", timeout:=10000)
        .FindElementByXPath("//a[@class='call']", timeout:=10000).Click
    End With
End Sub
  • Related