Skip to content
Advertisement

Going through Chrome://settings by Selenium

I am using Java and Selenium to write a test, I use the code below to get into Chrome:setting

JavaScript

But when the page is open I can not find any of its web Elements, for example when I try to find “show advanced setting….” by this code

JavaScript

it throws an error saying that “no such element: Unable to locate element” I tried to located other elements, but they all failed. I saw this post here but it did not help.

Find the code below:

JavaScript

Advertisement

Answer

I haven’t tested this but I took your code snippet and cleaned it up a bit. Try this and see if it works. This should be pretty close.

Once you switch to the IFRAME context, you don’t need to reference the IFRAME as you did with w.findElement().

In general, Thread.sleep() is not a good practice. You should prefer to use WebDriverWait with ExpectedConditions. Check the docs for all the different things you can wait for using ExpectedConditions. I used .elementToBeClickable() in my code below. This is perfect since you want to click an element. The .until() returns the element waited for so you can just append .click() on the end of the statement… or you can store the element in a WebElement variable and use it elsewhere.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement