I'm prototyping a script in irb and I'm running into a NoMethod error for '.use' when using the window switching api on tabs. Anything as simple as
b.windows.last.use
b.windows[2].use
Will not be respected and throw aNoMethodError: undefined method 'use' for nil:NilClass error while the window remains tabbed. If I drag the tab out to a separate window and run the same command it works as expected. Is this a known issue?
Please make sure the window you want to use is a real a new window of browser, not a tab, than you can use these methods described in this spec.I am not sure webdriver supports capturing a tab as a browser.
Related
I am trying to run an automated test and one of the steps of a test case is to clear the Ace Editor and insert text in it.
Earlier I had regular content editable DIV and I was able to insert text in it but not anymore after switching to Ace Editor.
All I am doing is calling "clear" method on the element and then "sendText" on it.
I tried adding "click" method before clear to make sure Ace Editor does have the focus and it did bring the focus to Ace Editor but it still throws an error that element should be user-editable to clear it.
I also tried putting a sleep of 5s before clearing it just in case, Clearing is getting triggered before Ace makes the div contenteditable.
Here's the exact error to be precise.
Failed: invalid element state: Element must be user-editable in order to clear it.
Tricky question.
Since Ace Editor is not native browser element, i looked up on api that they are provide. Seems like you can use .selection.selectAll() and .removeLines()
If i would be you - i would try to call JS function, that selects everything, and calls .removeLines()
await browser.executeScript(`editor_reference.selection.selectAll(); editor_reference.removeLines()`) // variable will be diferent, depending how you connected editor object
http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.executeScript
https://ace.c9.io/#nav=api&api=editor
You can see how it works right on their example page (https://ace.c9.io/) - execute this in browser console, editor should get cleared:
editor.selection.selectAll(); editor.removeLines()
send ctrl-a keys (cmd-a on mac) to select all before typing, so that clearing is not needed
I have no experience working with Ace editor before. I used demo ace editor from https://ace.c9.io/build/kitchen-sink.html to find a solution for the issue you are facing.
I tested the below piece of code in the demo Ace editor and it works fine.Not sure how the ace editor is implemented in your application.You can try it in your application and provide your thoughts.
browser.actions().mouseMove($(".ace_active-line")).click()
.sendKeys(protractor.Key.chord(protractor.Key.COMMAND, "a"))
.sendKeys(protractor.Key.BACK_SPACE)
.sendKeys("content in line1\ncontent in line2")
.perform()
If you are using windows machine then use protractor.Key.CONTROL instead of protractor.Key.COMMAND.
Hope this will work fine!
Say I want to look at an object and so I log it to the console:
console.log(theNoticeObj);
Then using Chrome Dev Tools, I inspect it in the console and change its property theNoticeObj.bounceHeight to 10px
Now if I want to trigger theNoticeObj.bounce() on that object immediately to locate it, is there an easy way to do that from the console?
Thanks
EDIT:
Breakpoints where suggested below, but this freezes execution.
In face what I want is the command line API to work with javascript objects, not just DOM elements. If that were possible I'm sure I would be able to find it. I might go and see if there are any feature requests to that end for chrome.
https://developers.google.com/chrome-developer-tools/docs/console#using_the_command_line_api
Try adding window.tno = theNoticeObject under the console.log statement. Reload the page and see if you can execute tno.bounce() from the console. If theNoticeObject is still in scope, this should work.
You can navigate to the Sources tab and open your javascript file containing the piece of code you want to play with, in this case let us assume it is
console.log(theNoticeObj);
Once you find this line, you can set a breakpoint at this point and when your program execution comes to this line it will halt.
You can then use the Console tab to do operations on all the javascript objects in current local scope, window scope. You can simply call:
theNoticeObj.bounce();
It executes in the current context reflecting changes on the screen.
Hope this helps.
Now you can right click any object in the console and use "Store as global variable".
A new console line appears with the name of a new global variable holding reference to the selected object.
I have created a view in eclipse like console and it shows the errors to users.So when user clicks on that error it should go to that line number.How should I do this?
Throw away your selfmade view, implement the console factory extension point instead to create new console sub windows in the existing console view. Afterwards implement the console pattern match extension point to find and link text segments in the console output.
Implementing a full view in Eclipse that behaves like an already existing view is always wrong. All of the existing views in the eclipse platform have extension points to change and enhance them. Nobody really wants to have 5 different console views being shown in a perspective.
So its been a while since I last touched the GUI for this application. Today I tried to open the main form and got this error message:
Note everything compiles/runs perfectly, I get no errors whatsoever.
It might be because you used to have a custom GUI window/panel/component and you modified that class. Now the IDE does not recognize it anymore, so just press "Not editable" button when NetBeans Shows you the dialog, then perform a "Clean and Build" (the broom and hammer icon). After build completes close and reopen the IDE. It worked form me.
It an error that append sometimes when you switch from a version to an other. I get the same issue, I got the message but all run well.
If you want more informations about the problem encoutered, go in :
(In the menu bar) View -> IDE Log
here you should see the details of the error when you get this Warning window.
I need to disable the "Exceptions" window that pops when you encounter an IDE error in Netbeans - I always report when I can but is driving me crazy right now.
Don't get me wrong, I love the application, but I'm getting tired of the errors on my screen, sometimes needing to delete a file and create him again to enable me to continue.
I can drag it to the side but my mouse loses focus.
I'm using Windows 7 and latest version of Java (netbeans PHP ide)
Is this possible?
You need to modify <netbeans-install-dir>/etc/netbeans.conf
Add
-J-Dnetbeans.exception.alert.min.level=99999 -J-Dnetbeans.exception.report.min.level=99999
to the netbeans_default_options entry.
You have to set some properties when launching Netbeans. Modify your application configuration in "nbproject/platform.properties" by finding a line run.args.extra=... and adding at the end:
-J-Dnetbeans.exception.alert.min.level=99999 -J-Dnetbeans.exception.report.min.level=99999
You'll find the details in Netbeans' wiki.
I would recommend using -J-Dnetbeans.exception.report.min.level=99999 but not the other one. This means the error icon will still appear when there is a problem, and you can report the error if you have a moment, but no dialog will pop up without your asking it to.