google-chrome

How do I send a message from the background to a popup in a Chrome extension everytime a page gets loaded?

南笙酒味 提交于 2021-02-08 11:29:19
问题 I can send a message from a popup to a background via: background.js chrome.runtime.onMessage.addListener( function(request) { alert(request.data.subject); } ); popup.js chrome.runtime.sendMessage({ msg: "something_completed", data: { subject: "Loading...", content: "Just completed!" } }); The alert loads fine BUT I need to do the opposite. I would like the background to send an api call when a page is loaded and send the results of that api call to the popup.js so that it can make changes to

why xpath derived from chrome does not work

隐身守侯 提交于 2021-02-08 11:19:27
问题 I am trying to scrap data from web of science And here is the specific page I am going to work with. Below is the code I use for extract the abstract: import lxml import requests url = 'https://apps.webofknowledge.com/full_record.do?product=WOS&search_mode=GeneralSearch&qid=2&SID=Q1yAnqE4al4KxALF7RM&page=1&doc=3&cacheurlFromRightClick=no' s = requests.Session() d = s.get(url) soup1 = etree.HTML(d.text) And here is the xpath I got through the copy xpath in Chrome: //*[@id="records_form"]/div

How to start Chrome (both normal & incognito modes) and open URL in remote PC (node) using Selenium Grid in Java?

一曲冷凌霜 提交于 2021-02-08 10:40:17
问题 I am trying Selenium Grid in Java and just want to start Chrome in both normal mode and incognito mode in remote PC (node) and open google.com I have setup the hub - node connection. I tried this code, but it seems to be wrong. Any guidance how to do that? How to use capability.setCapability() ? I found some example to start IE and just replaced the word InternetExplorer with Chrome ... Doesn't work. Thanks. Not working code: System.setProperty("webdriver.chrome.driver" , "C:/Users

webkit-overflow-scrolling makes element disappear

前提是你 提交于 2021-02-08 10:35:20
问题 I have an app / site where I'm using -webkit-overflow-scrolling: touch; to make the scrolling smooth on iOS. However, recently it started causing my navbar disappear upon initial load (using iOS) and it only appears when certain elements were scrolled up or down, it makes the navbar completely unusable. If I comment out the -webkit-overflow-scrolling: touch; then it works perfectly but the momentum scrolling is gone. I've tried adding a z-index hack to the navbar to make sure it's loading on

Disable cache for certain resource programmatically

痴心易碎 提交于 2021-02-08 10:14:58
问题 I have this setting in Chrome devtools: this setting works for me. However, I also want to disable the cache for certain resources. My question is - is there a way to disable the cache for a resource when you use fetch? fetch(url).then(v => {}); is there some option or header that we can use to prevent the browser from using the cache to retrieve the resource? 回答1: This has the answers I was looking for: https://hacks.mozilla.org/2016/03/referrer-and-cache-control-apis-for-fetch/ first make

Chrome 75, break transform-origin animation

偶尔善良 提交于 2021-02-08 10:02:10
问题 I found possible issue(or may be it is feature =)) in chrome 75 version. Changes of transform origin during of transform animation doesn't affect on animation. I attached snipet which contains two loops, one changed transform, another changed transform origin. For example: In changelog for 75 version I found this commit which probably related to this issue: commit const div = document.getElementById('div'); const stat1 = document.getElementById('stat1'); const stat2 = document.getElementById(

Focus sibling window in Chrome

为君一笑 提交于 2021-02-08 09:32:49
问题 I've got an application which has several child windows. For user experience reasons, sometimes we want to re-use these windows instead of always opening new ones. So the main window has two child windows, A and B. The user is using Child A. As a result of their action in Child A, we wish to focus Child B and perform an action on it. I have complete control of the source for all windows involved. Unfortunately, it seems like Child A no longer has the right to focus Child B in Chrome. The main

Focus sibling window in Chrome

落花浮王杯 提交于 2021-02-08 09:32:47
问题 I've got an application which has several child windows. For user experience reasons, sometimes we want to re-use these windows instead of always opening new ones. So the main window has two child windows, A and B. The user is using Child A. As a result of their action in Child A, we wish to focus Child B and perform an action on it. I have complete control of the source for all windows involved. Unfortunately, it seems like Child A no longer has the right to focus Child B in Chrome. The main

Disable “Clear cookies and site data when you quit Chromium” programatically

时间秒杀一切 提交于 2021-02-08 09:06:17
问题 I see this "Clear cookies and site data when you quit Chromium" on Chrome's and Chromium's settings. I would like to change disable it when starting browser with Selenium. I didn't find any chrome option, nor any chrome argument that would help. I have check this code of Chromium, where are all the prefs but I didn't find anything regarding to cookies, site data, quit, exit, cleanup. Also not finding any relevant on the chromium arguments: https://peter.sh/experiments/chromium-command-line

Disable “Clear cookies and site data when you quit Chromium” programatically

余生长醉 提交于 2021-02-08 09:06:11
问题 I see this "Clear cookies and site data when you quit Chromium" on Chrome's and Chromium's settings. I would like to change disable it when starting browser with Selenium. I didn't find any chrome option, nor any chrome argument that would help. I have check this code of Chromium, where are all the prefs but I didn't find anything regarding to cookies, site data, quit, exit, cleanup. Also not finding any relevant on the chromium arguments: https://peter.sh/experiments/chromium-command-line