How can I use persisted cookies from a file using phantomjs

Phantom JS and cookies –cookies-file=cookies.txt will only store non-session cookies in the cookie jar. Login and authentication is more commonly based on session cookies. What about session cookies? To save these is quite simple, but you should consider that they will likely expire quickly. You need to write your program logic to consider this. For … Read more

How to programmatically fill input elements built with React?

This accepted solution appears not to work in React > 15.6 (including React 16) as a result of changes to de-dupe input and change events. You can see the React discussion here: https://github.com/facebook/react/issues/10135 And the suggested workaround here: https://github.com/facebook/react/issues/10135#issuecomment-314441175 Reproduced here for convenience: Instead of input.value=”foo”; input.dispatchEvent(new Event(‘input’, {bubbles: true})); You would use function setNativeValue(element, … 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 can i use soft assertion in Cypress

The soft assertion concept is pretty cool, and you can add it with minimal implementation to Cypress const jsonAssertion = require(“soft-assert”) it(‘asserts several times and only fails at the end’, () => { jsonAssertion.softAssert(10, 12, “expected actual mismatch”); // some more assertions, not causing a failure jsonAssertion.softAssertAll(); // Now fail the test if above fails … Read more

reusing Internet Explorer COM Automation Object

Try This: Set IEObject = GetObject( ,”InternetExplorer.Application” ) *Notice the comma before “InternetExplorer.Application” EDIT: Try this: Dim IE As SHDocVw.InternetExplorer Set IE = GetObject(,”InternetExplorer.Application”) You can also try this: Dim ShellApp Set ShellApp = CreateObject(“Shell.Application”) Dim ShellWindows Set ShellWindows = ShellApp.Windows() Dim i For i = 0 To ShellWindows.Count – 1 If InStr(ShellWindows.Item(i).FullName, “iexplore.exe”) <> … Read more

Clicking a button on a page using a Greasemonkey/userscript in Chrome

Note: jQuery .click() does not work reliably on click events that were not set via jQuery in the first place. You need to create the right kind of event; createEvent(‘Events’) is not the way. As Jim Deville pointed out, the link pseudo-button was not being selected. You do not need jQuery for this (so far). … Read more

UI Automation “Selected text”

private void button1_Click(object sender, EventArgs e) { Process[] plist = Process.GetProcesses(); foreach (Process p in plist) { if (p.ProcessName == “notepad”) { AutomationElement ae = AutomationElement.FromHandle(p.MainWindowHandle); AutomationElement npEdit = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, “Edit”)); TextPattern tp = npEdit.GetCurrentPattern(TextPattern.Pattern) as TextPattern; TextPatternRange[] trs; if (tp.SupportedTextSelection == SupportedTextSelection.None) { return; } else { trs = tp.GetSelection(); lblSelectedText.Text = … Read more