Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Images - Selenium VBA Chromedriver

So I am only a beginner on my path to learning vba and selenium. I was trying to click a button in the chrome settings to disable images, however I couldn't figure out how to achieve this.

I used the following url:

chrome://settings/content/images

And then tried to click on the toggle button with

driver.FindElementByCss("#button").Click

However, I always get the error "Element not visible".

So I figured out it has to be because of the "#shadow root" in the html code. However I have no idea what that means or how to figure out a way to access the element... any tips on how I could figure out a way to solve this are very appreciated :-)

Thank you for your help!

like image 374
Websitewichtel Avatar asked Nov 22 '25 13:11

Websitewichtel


1 Answers

This doesn't answer the question with regards to how you can actually click the button, but it does get the the result you're looking for ;)

Sub toggle_images()

Dim bot As New WebDriver
bot.Start "chrome", "chrome://settings/content/images"
bot.Get "/"

For i = 1 To 21
    bot.SendKeys bot.Keys.Tab
Next i

bot.SendKeys bot.Keys.Enter

End Sub
like image 129
newuser2967 Avatar answered Nov 24 '25 09:11

newuser2967



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!