In selenium excel vba I am trying to learn more about how to deal with the CSS selectors And I am wondering because when inspecting an element with ID and when run the code I go
The element is inside of an iframe
with id searchCaseDiv. You have to switch to that iframe to be able to access the element.
Use .SwitchToFrame
to switch frame.
For java, it would be like this,
driver.switchTo().frame("searchCaseDiv");
To send a character sequence to the Username field as the the desired element are within an <iframe>
so you have to:
You can use the following solution:
With bot
.Start "Chrome"
.Get "https://www.kuwaitcourts.gov.kw/searchPages/searchCases.jsp"
.SwitchToFrame "searchCaseDiv"
.FindElementByCss("input[type=text][name='txtCaseNo']").SendKeys sCase
You can find a relevant discussion in How to send text with in the username field within an iframe using Selenium VBA
Ways to deal with #document under iframe