HtmlUnit Doesn't Recognize Valid CSS - css

So, I just started using HtmlUnit (literally just now), and I've already run into an error. I have some simple code:
fun getPage() { val page: Page = WebClient().getPage("http://htmlunit.sourceforge.net") }
However, it throws an extremely long error:
WARNING: CSS error: 'http://htmlunit.sourceforge.net/css/apache-maven-fluido-1.5.min.css' [9:90176] Error in declaration. '*' is not allowed as first char of a property.
Jan 24, 2018 4:14:58 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'http://htmlunit.sourceforge.net/css/apache-maven-fluido-1.5.min.css' [9:91151] Error in declaration. '*' is not allowed as first char of a property.
Jan 24, 2018 4:14:59 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'text/javascript'.
Jan 24, 2018 4:15:00 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError
//continues the above sequence a lot, and then ends with:
SEVERE: runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://htmlunit.sourceforge.net/js/apache-maven-fluido-1.5.min.js] line=[25] lineSource=[null] lineOffset=[0]
I looked at the link provided by the error, and it seems to contain a lot of asterisks inside of their CSS. 194, to be exact (including asterisks used in the commented area). I also experimented with loading other web pages, and it appears to be that it has issues understanding that the CSS of web-pages is valid.
Am I doing something wrong, or should I just tell it to ignore CSS? (I'm not sure if that's possible, but I would prefer it.)

At first regarding the css warning
it is a warning
see star hack for more info about this
if you still think this is valid css please open an CSSParser issue and i will have a look
Second: An invalid or illegal selector was specified....
This is really common if you are testing pages with HtmlUnit. The background is that many javascript libs (like sizzle used by jQuery) doing some checks to figure out what features are supported by your browser. And the output you see is the result of one of this checks. This one tries to figure out, if the javascript select method is able to work with a special kind of css-selectors. There is a try-catch around this selector usage in the javascript code and if the selector fails (in fact this happens in many browsers) the features is not available and the lib falls back to some other way to do the selection. The reason for seeing this in the error log is part of HtmlUnit history. This lib was initially designed for web testing and based on this the lib logs every javascript exception at the moment the exception is thrown (even if the exception is catched/handled later on). So you can more or less ignore this; the HtmlUnit does not stop working because of this.

Related

How to locate the method using an error message string?

I would like to know where is this error code located in the AOT. Would like to know the path to understand the structure and develop custom code.
Transaction has been selected, for settlement, although settlement type: none was selected
I generally use one of two methods to locate message strings.
Provided the cross reference is updated (it should be in dev) use the "Label editor" to to search for then string, see this answer.
Put a breakpoint in top of info.add method, disable CIL if needed, then rerun to get the error message invoking the debugger, see this answer.

How to remove the 'WARNING: CSS Error parsing':

There is a warning everytime I run the program, I don't know where the problem is because at [1, 19] of all of my css files I have a comment. I tried to fix this by removing the comment and it made no difference. Please help.
WARNING: CSS Error parsing '*{-fx-font-family: ;}: Unexpected token ';' at [1,19]
[]1
In javaFx you can use CSS with two ways : you can customise your fxml file by using scene builder or by according a css file.I had the same problem ,when the JavaFX CSS parser encounters a syntax error, a warning message is emitted which conveys as much information as is available to help resolve the error. For example
WARNING: com.sun.javafx.css.parser.CSSParser declaration Expected
'' while parsing '-fx-background-color' at ?[1,49]
The cryptic '?[1,49]' pertains to the location of the error. The
format of the location string is
[line, position]
If the error is found while parsing a file, the file URL will be given. If the error is from an inline style (as in the example above), the URL is given as a question mark. The line and position give an offset into the file or string where the token begins. Please note that the line and position may not be accurate in releases prior to JavaFX 2.2.
Applications needing to detect errors from the parser can add a listener to the errors property of com.sun.javafx.css.StyleManager. This is not public API and is subject to change.
I think you add a value by using scene builder and you are adding ; to your value and this is not acceptable in scene builder you need to remove ;.
To resolve your problem ,go to your fxml file in your IDE ,i think you are using Netbeans and click right button of mouse --> edit , you can find your warning.

Ruby/Selenium/Watir-Webdriver: "path is not absolute" error for absolute path

document_name ='TestDoc'
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
File.new ("/Users/Me/QA/Project/Documents/#{document_name}") # => File is created
filename_field.send_keys("#{document_path}")
filename_field.send_keys :tab # => To Trigger event but where error occurs
filename_field = browser.file_field(:name, 'file') declared in a module elsewhere.
As far as I can tell, I have provided an absolute path for the filename to upload the file but when the tab key is sent, an error occurs of:
Selenium::WebDriver::Error::UnknownError: unknown error: path is not absolute:
With an odd squiggly symbol in RubyMine that I've never seen before. Any ideas?
Update:
I added
puts filename_field.value
# => C:\fakepath\TestDoc
Spoke to one of the developers and she said "Browser does it to fake things out, so the filesystem isn't exposed". Not sure if that helps solve my issue or I'm SOL?
That error comes from Chromedriver, and comes from sending an incorrect path string to a file element. Since :tab is not a path, it is correctly raising an error.
You shouldn't need to send a tab; just sending the path of the file should accomplish what you need.
I see many small strange things in your code.
Why
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
Not
document_path = "/Users/Me/QA/Project/Documents/#{document_name}"
Why
filename_field.send_keys("#{document_path}")
Not
filename_field.send_keys(document_path)
But the main question is why you are using send_keys instead of set?
I failed to reproduce your problem. Maybe it will be possible if you will provide your html. But i suggest you to try:
filename_field.set(document_path)
Because you can easily check it even with irb send_keys is acting differently in firefox and in chrome for example. So maybe problem with it.
Another suggestion
That is a much more weak idea. But...
Try to clear value before changing it. You can do it with javascript:
b.execute_script("arguments[0].value=''", field)
I had the same issue with Chromedriver 2.26.436421 and it was solved when I removed the code which was sending the tab key.
With previous Chromedriver sending tab key was required to trigger the change event on the file input but with latest one it seems like it is only causing issues and the change event gets triggered without it.

Parsing Meteor error: Exception from Deps afterFlush

I get these Deps errors from time to time and I can never figure out what they mean or what they're pointing to:
Exception from Deps afterFlush function function: SyntaxError: Unexpected identifier
at eval (native)
at http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:372:22
at Function.jQuery.extend.globalEval (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:373:7)
at jQuery.ajaxSetup.converters.text script (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9806:11)
at ajaxConvert (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:8873:18)
at done (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9293:15)
at callback (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9753:8)
at Object.send (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9759:7)
at Function.jQuery.extend.ajax (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9244:15)
at Function.jQuery._evalUrl (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9409:16) debug.js:41
It thinks that there is a syntax error, but the only files it points to are jquery.js, which I HIGHLY doubt contain errors...
This error is caused by code in a Template helper somewhere that uses JQuery/a jquery plugin and is running code using eval which contains a syntax error in it, which is why it appears to come from JQuery itself.
There isn't much more than this to go off im afraid. It might be from ajax. Have a look at your chrome's network tab to see what is being downloaded just before this happens and see if it contains any javascript.
If it contains HTML when it should contain javascript check your Meteor paths, Meteor does not throw 404 errors, instead it serves out the main page's html, which may be why the error displays this way instead of a 404
I just came across the similar "afterFlush" error, and while my error was also rooted in a jQuery/plugin with Meteor, it had nothing to do with eval.
The issue circled back around to updating the DOM at the same time I was updating a reactive method, where Meteor was also updating the DOM reactively. I found this out, and removed the manual DOM manipulation, which made this error go away. Hope someone else finds this helpful...

Add Source file link to the default ASP.NET Server Error page?

Has anyone ever thought to attempt to modify the default ASP.NET Server error page to provide a link BACK to the error source in Visual Studio?
Consider the following standard error page in ASP.NET:
Server Error in '/myproject'
Application.
Invalid object name 'usp_DoSomething'.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.Data.SqlClient.SqlException:
Invalid object name 'usp_DoSomething'.
Source Error:
Line 4323: cmd.CommandText = "usp_DoSomething";
Line 4324:
Line 4325: using (var dr = cmd.ExecuteReader())
Line 4326: {
Line 4327: if (dr != null)
Source File:
c:\development\myproject\myproject.components\providers\sql\sqldataprovider.cs
Line: 4325
When an error like this is generated, the HTML has the source back to the file the error occurs in and the line number. Has anyone ever written or thought of writing some mechanism to turn the text into a link back to the error in Visual Studio?
I've never seen anything that does it, but it just seems like it would be a helluva nice feature and I think about it in the back of my mind every time an error occurs when I have to manually go find it in the source. It would just be nice to be able to click a link to take me straight there.
Anyone written any, or know of any solutions for this. I use Chrome or Firefox as my browsers of choice, but I'd even consider using IE again if someone found a plugin that did this.
Thanks,
Max
Well, I had been hoping for some means of hacking the error page to turn this:
c:\development\myproject\myproject.components\providers\sql\sqldataprovider.cs Line: 4325
into a link back into my source code in Visual Studio... being that the file name and line number is provided. I was thinking of a browser plugin or something, but apparently no one has built anything like that before... oh well. Was worth a shot.

Resources