sha
11 years agoContributor
JavaScript eval crashes Fifo 31
I am using the following Keyword Testing code in my test:
Run Code Snippet Aliases.browser.pageMain.contentDocument.Script.eval("localStorage.setItem(\"lastUsedTextProperties\", '{\"fontStyle\":\"400\",\"color\":\"#008800\",\"fontSize\":20,\"fontFamily\":\"Arial\"}');")
to ensure a stable basis for testing.
It used to work, but does not work anymore. When it runs, Firefox crashes with a Mozilla Crash Reporter pop-up. I reckon it is the change from Fifo 30 to 31 that made the difference.
When I run the a "console.log(\"Hullo"\");" through TestComplete it works Ok, and when I run the problematic JavaScript directly in the Firefox (through Firebug Console), it works OK.
Are there better ways to set the localstorage in the browser?
/Søren Harder
QA Engineer, Zmags
Run Code Snippet Aliases.browser.pageMain.contentDocument.Script.eval("localStorage.setItem(\"lastUsedTextProperties\", '{\"fontStyle\":\"400\",\"color\":\"#008800\",\"fontSize\":20,\"fontFamily\":\"Arial\"}');")
to ensure a stable basis for testing.
It used to work, but does not work anymore. When it runs, Firefox crashes with a Mozilla Crash Reporter pop-up. I reckon it is the change from Fifo 30 to 31 that made the difference.
When I run the a "console.log(\"Hullo"\");" through TestComplete it works Ok, and when I run the problematic JavaScript directly in the Firefox (through Firebug Console), it works OK.
Are there better ways to set the localstorage in the browser?
/Søren Harder
QA Engineer, Zmags
- Hi Søren,
You can try accessing localStorage through contentDocument.defaultView:
Aliases.browser.pageMain.contentDocument.defaultView.localStorage.setItem("lastUsedTextProperties", "{'fontStyle':'400','color':'#008800','fontSize':20,'fontFamily':'Arial'}")