I tested the following jQuery on a jQueryfied page to inject custom CSS code to the page:
jQuery('head').append('<style type=\"text/css\">body { background: #000; }</style>');
After that, the background of the page immediately turns black, so far so good. But if i try that with Selenium 2 (Java), i do not see any reaction:
((JavascriptExecutor) webDriver).executeScript("jQuery('head').append('<style type=\"text/css\">body { background: #000; }</style>');");
jQuery is loaded correctly. Any ideas why that does not work?
why use an awkward style tag injection that depends on jQuery? Why not use something simple like