browser

Python 3.5 - Selenium - How to handle a new window and wait until it is fully loaded?

女生的网名这么多〃 提交于 2020-08-19 17:54:00
问题 I am doing browser automation and I am blocked at a certain point: at a moment, I ask the browser to click on a button, which in turn open up a new window. But sometimes the Internet is too slow, and so this new window takes time to load. I want to know how can I ask Selenium to wait until this new fresh window is fully loaded. Here's my code: driver.switch_to.default_content() Button = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, 'addPicturesBtn'))) Button.click()

Python 3.5 - Selenium - How to handle a new window and wait until it is fully loaded?

偶尔善良 提交于 2020-08-19 17:52:17
问题 I am doing browser automation and I am blocked at a certain point: at a moment, I ask the browser to click on a button, which in turn open up a new window. But sometimes the Internet is too slow, and so this new window takes time to load. I want to know how can I ask Selenium to wait until this new fresh window is fully loaded. Here's my code: driver.switch_to.default_content() Button = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, 'addPicturesBtn'))) Button.click()

Change content of title tag, when switching to other open tab in the browser

扶醉桌前 提交于 2020-08-17 17:49:49
问题 I just recently saw this on two different websites, does anyone know how it is done? If you have multiple tabs open, and you leave the current one, the title in the tab is changed. Very nice trick! http://blog.invisionapp.com/ http://zerosixthree.se/create-a-responsive-header-video-with-graceful-degradation/ 回答1: This works by registering Handlers on the onfocus and onblur events of window . jQuery-Style: $(window).on('blur', function() { ... }); Without jQuery: window.onblur = function() { .

Error when connecting to a secure Socket.io connection using self signed certificate from a browser app

你离开我真会死。 提交于 2020-08-10 20:20:27
问题 Socket.io client API documentation suggests that the client should pass the self signed certificate in the connection request to the server: // client-side const socket = io({ca: fs.readFileSync('server-cert.pem'),rejectUnauthorized: false}); This works great in a node environment. How to make this work in a BROWSER javascript app? I am facing two issues: How can I include the certificate file in the browser app? readfileSync cannot find the file If I only include rejectUnauthorized: false in

Distinguish between touch only and mouse-and-touch devices

谁说我不能喝 提交于 2020-08-09 09:04:25
问题 Right now, I am working on a part of a project which supports drag and drop. Look at the picture for clarification: Even though it is German, I guess it is straightforward: The User can drag the blue boxes from the top saying "Verfügbare Empfänger" on the gray areas below. This works just fine. On mobile devices, I just removed the drag and drop and the gray areas and can add the blue boxes by clicking on them. Now for the actual problem: in order to detect touch, I used the following

How to get default browser name using python?

。_饼干妹妹 提交于 2020-08-08 05:26:49
问题 Following solutions (actually it is only one) doesn't work to me : How to get a name of default browser using python How to get name of the default browser in windows using python? Solution was: from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValue # In Py3, this module is called winreg without the underscore with OpenKey(HKEY_CURRENT_USER, r"Software\Classes\http\shell\open\command") as key: cmd = QueryValue(key, None) But unfortunately, in Windows 10 Pro I don't have targeted registry

XPath 3 in browser

青春壹個敷衍的年華 提交于 2020-08-08 05:17:25
问题 When we see conformance chart, such as https://caniuse.com/#search=xpath and https://developer.microsoft.com/en-us/microsoft-edge/platform/status/domlevel3xpath/?q=xpath, it's usually about DOM Level 3 XPath that focuses on accessing DOM object using XPath 1.0 , but not necessarily XPath 3.0 or higher. Question 1 - Is there any explicit version requirement for browsers by W3C etc. to support newer versions of XPath? This XPath 1.0 feature works: document.evaluate( 'normalize-space(" X ")',

Disable browser back action using jquery

旧城冷巷雨未停 提交于 2020-08-03 10:19:28
问题 I am developing an online testing app and it is required that during the test, users cannot be allowed to refresh page neither go back until the test is ended. I have successfully been able to disable refresh action in jquery through all means possible (to the best of my knowledge) using the following code: $(window).bind({ beforeunload: function(ev) { ev.preventDefault(); }, unload: function(ev) { ev.preventDefault(); } }); But I have been having troubles disabling the back action on all

How to make TWebBrowser ignore accelerator chars of others controls?

北慕城南 提交于 2020-08-03 03:25:11
问题 I have a TWebBrowser placed on a form with the designMode enabled. Bellow the browser I have a close button with the Caption set to 'Clos&e'. When I am editing the contents of a document inside the WebBrowser and I press the key E the button close is called. It appears that it is treating TWebBrowser like other controls that don't handle keys and/or don't accept chars (e.g. TButton). How can I solve this? Thanks in advance. 回答1: Descend from TWebBrowser, override the CN_CHAR message handler,

Is it possible to validate my JavaScript library using a public/private key signing method?

若如初见. 提交于 2020-07-31 06:01:32
问题 I am dynamically loading my JavaScript as a "plugin" on a third party's page and would like to verify that it's coming from me. I can use the content SRI, however I update the library frequently and need it to be dynamically loaded. Below is an example of what I'd like to see. Is there a way I can achieve this? const publickey = '...my-key...' const response = await fetch('https://example.com/my-library.js') const sig = response.headers.get('X-Signature') const text = await response.text()