141. How to work with Advertisement pop-up
Use driver.switchTo().frame() if it’s inside an iframe, or handle with XPath.
142. How to handle File Download Pop-up
Use AutoIT, Robot class, or browser profile setup (e.g., in Firefox/Chrome).
143. File Upload with
driver.findElement(By.id(“uploadfile”)).sendKeys(“C:\\path\\to\\file.txt”);
144. File Upload without file input type
Use AutoIT or Robot class.
145. Handle Browser Scroll-bar
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(“window.scrollBy(0,500)”);
146. Execute JavaScript
Same as above.
Frame Handling
148. How to work with frame window
driver.switchTo().frame(“frameName”);
149. How to Work with nested frame
driver.switchTo().frame(“outer”).switchTo().frame(“inner”);
150. Work with multiple frames
Use index or name to loop and switch.
151. Ways to work with frame
- By name/id
- By index
- By WebElement
152. Handle frame without id or name
WebElement frame = driver.findElement(By.xpath(“//iframe[contains(@src,’something’)])));
driver.switchTo().frame(frame);
Multiple Browser Handling
153. What is IllegalStateException
Thrown when WebDriver path is not set properly.
154. Work with IE, Chrome browser
Set driver paths:
System.setProperty(“webdriver.chrome.driver”, “path”);
WebDriver driver = new ChromeDriver();
155. How to write XPath in IE & Chrome
XPath writing is same but Chrome DevTools offer better inspection.
//input[@id=’email’]
This concludes the advanced level TestNG and Selenium interview questions from For better visibility, include keywords like Advanced Selenium Interview Questions, TestNG dropdown handling, JavaScriptExecutor in Selenium, and Selenium Frame Handling in your SEO metadata.