How to specify your webpage’s language so Google Chrome doesn’t offer to translate it

Google Chrome currently requires several tags to make an (HTML5) document opt out of translation. Before doing this, you should be sure that you know your audience’s language, as otherwise it will prevent foreign sites from properly translating your site. The relevant tags are: <meta charset=”UTF-8″ /> <meta name=”google” content=”notranslate” /> <meta http-equiv=”Content-Language” content=”en_US” /> … Read more

Puppeteer wait for all images to load then take screenshot

There is a built-in option for that: await page.goto(‘https://www.digg.com/’, {“waitUntil” : “networkidle0”}); networkidle0 – consider navigation to be finished when there are no more than 0 network connections for at least 500 ms networkidle2 – consider navigation to be finished when there are no more than 2 network connections for at least 500 ms. Of … Read more

How to open Chrome browser console through Selenium?

To open chrome browser console you can use the ChromeOptions class with –auto-open-devtools-for-tabs argument as follows: Test Configuration: Selenium: Selenium Standalone Server v3.14.0 ChromeDriver: ChromeDriver 2.46.628402 Chrome: Google Chrome 72.0.3626.96 Code Block: import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; public class A_Chrome_Browser_Console { public static void main(String[] args) { System.setProperty(“webdriver.chrome.driver”, “C:\\Utility\\BrowserDrivers\\chromedriver.exe”); ChromeOptions options = new ChromeOptions(); … Read more

Creating Google Chrome shortcut with –disable-web-security

Just clone the shortcut for chrome you have on your desktop, and then in the shortcut properties add the parameter –disable-web-security (and –user-data-dir) at the end of chrome executable path e.g “C:\Program Files\Google\Chrome\Application\chrome.exe” –disable-web-security –user-data-dir=”C:\tmpChromeSession” Edit #1 : I changed google chrome path, the old one was not correct. I just tried it on XP … Read more

How do you detect between a Desktop and Mobile Chrome User Agent?

The problem is the user agent will always have “Chrome” whether it is the desktop or mobile version. So you have to check the more specific case first. $(document).ready(function(){ var ua = navigator.userAgent; if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(ua)) $(‘a.mobile-other’).show(); else if(/Chrome/i.test(ua)) $(‘a.chrome’).show(); else $(‘a.desktop-other’).show(); });

blocked a frame of origin “null” from accessing a cross-origin frame – chrome

This happens because Chrome doesn’t allow frames from your hard disk to access each others’ content. Which, technically we term as Cross-origin request. Solution of the above problem is: 1. Either you host your webpage on a local web server. See the following link: What is a faster alternative to Python’s http.server (or SimpleHTTPServer)? 2. … Read more