Java

How to Steer Frame in Selenium

Switch to frame Select a frame by its (zero-based) index driver.switchTo().frame(int index) Select a frame by its name or ID driver.switchTo().frame(String nameOrId) Select a frame by WebElement driver.switchTo().frame(WebElement frameElement) Change focus to the parent context. If the current context is the top level browsing context, the context remains unchanged driver.switchTo().parentFrame(); Selects either the first frame on the page, or the main document when a page contains iframes driver.

Using JavaMail to Search GMail With IMAP

Enable IMAP in GMail Log into your GMail account and go to Settings Switch to tab “Forwarding and POP/IMAP” Select Enable IMAP Set Folder size limits to Limit IMAP folders to contain no more than this many messages 1,000 Less secure app access Go to https://myaccount.google.com/lesssecureapps?pli=1 Turn on Allow less secure apps if this is not turned on, we will get following exception javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Invalid credentials (Failure) at com.

Reusing Existing Browser Session in Selenium

During script development or debugging in selenium, if we can attach the code to an existing browser session, it will make things easier. Here is how to do it with Chrome. Open chrome with remote debugging port "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 Start chrome driver WebDriver wdriver =null; ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("debuggerAddress", "127.0.0.1:9222"); driver = new ChromeDriver(options);