I use Selenium, it costs phantomJS driver. The task is to disable css. The code is already there, but how to format it for Java is not clear to me.
jsDriver.executePhantomJS( "this.onResourceRequested = function(request, net) { " + "if ((/http:\/\/.+?\.css/gi).test(requestData['url']) || requestData['Content-Type'] == 'text/css') {" + "console.log('The url of the request is matching. Aborting: ' + requestData['url']);" + "request.abort();" + "}" + "};"); Swears at the line with the condition if ((/http:\/\/.+?\.css/gi).test(requestData['url']) || requestData['Content-Type'] == 'text/css') {
Illegal escape character in string literal
How to proceed? Wednesday Intellij
UPD: does not work like this:
(/http:\\/\\/.+?\\.css/gi)