KeyModifier.SHIFT not working in Sikuli - sikuli

I am new to Sikuli. I need to do Ctrl+Shift+Down in Sikuli.
I have tried:
type(Key.DOWN, KeyModifier.SHIFT + KeyModifier.CTRL)
and
type(Key.DOWN, KeyModifier.SHIFT|KeyModifier.CTRL)
but none of them works.Both produce the same effect as pressing Ctrl+Down.
Please help.

Due to some bug, Shift combinations do not work if NumLock is on.
The solution I used was to toggle it using:
type(Key.NUM_LOCK)
I found the answer here: https://answers.launchpad.net/sikuli/+question/272223

How about this:
# Push down keys.
keyDown(Key.CTRL)
keyDown(Key.SHIFT)
type(Key.DOWN)
# Release keys.
keyUp()

Try this:
type(Key.DOWN, KeyModifier.SHIFT, KeyModifier.CTRL) 
Pay attention that i only use "," not "+".

Related

VS code Error : settings.json property expected (bug)

enter image description here
When I use VS Code, a problem notice likes that(in the above image) is printed.
Although I want to fix it and really don't want to see it, I can't find any way to fix.
I am very painful about just seeing that error message all the time.
Please give me some helps.
You opened a { parenthesis at line 2784 and didn't close it. You should close it. --> }
Also, you have an extra comma , at 2793 that you have to remove.
Not use {}, because you may already mess your settings.json before.
so my suggestion as follows:
// in/your/settings.json/file
...
setting0_name:[setting0.0, setting0.1],
seting1_name : settings,
...

Unable to locate element (without Id) in webpage using selenium

I've been trying to access/locate the element shown in the image and have tried various methods. xpath, classname, css but keep getting the error that the element cannot be found. Can you help please ?
Attempt1
driver.find_element_by_class_name(".btn.btn-default").send_keys(os.getcwd() + "InputFiles/Error.png")
Error:
Attemp2:
driver.find_element_by_xpath("//div[#class='upload-btn__wrapper']").send_keys(os.getcwd() + "InputFiles/Error.png")
Error:
This xpath is supposed to work.
"//div[#class='upload-btn__wrapper']/button"
Hope this helps. Thanks.
Hope it help you. Let me know if you need further assistance.
driver.find_element_by_xpath("//div[#class='upload-btn__wrapper']")
I suggest to use below Xpath as it will rely on your Text, so any changes in text of the button will result a failure of the test, which makes perfect sense.
//button[normalize-space(text())='Choose image']
Also use explicit wait before performing any operations with that element.
new WebDriverWait(driver, time).until(ExpectedConditions.visibilityOf(By.xpath("//button[normalize-space(text())='Choose image']")));
WebElement chooseImageButton=driver.findElement(By.xpath("//button[normalize-space(text())='Choose image']"));
chooseImageButton.click();
Try the below solution as well :
driver.findElement(By.xpath("//div[contains(#class,'margin-bottom')]")).findElement(By.xpath("//div[contains(#class,'upload-btn__wrapper')]")).click();
Explanation : I am navigating from the parent div which is "margin-bottom" div class and reaching out to the child div which we want to locate, which is "upload-btn__wrapper".
Let me know, if this works out.
You can click on it with css selector also. Hope this will work for you.
driver.findElement(By.cssSelector(".btn.btn-default")).click();

BUG - No done button for select tag in IOS

I'm using the latest ionic and have a simple select tag.
<select class="assertive bold" ng-change="changeQuantity({cartItem: part})" ng-model="part.quantity" ng-options="n for n in [] | range:1:101"></select>
When I run the code with ionic emulate ios
Why is there no done button for the select? Shouldn't that be default? How do I fix this to display a done button?
Although this is a late answer, I'm sure more people will end up here while searching for a solution to this issue.
By default in your app.js in .run() the hideKeyboardAccessoryBar is set to true, so just find
if (window.cordova && window.cordova.plugins.Keyboard) {
window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
and change it to
if (window.cordova && window.cordova.plugins.Keyboard) {
window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
}
What worked for me is doing:
if (Keyboard) {
Keyboard.hideFormAccessoryBar(false);
Keyboard.hideKeyboardAccessoryBar(false);
}
The new plugin was exposed as global Keyboard, rather than cordova.plugins.Keyboard, and then the hideFormAccessoryBar is for form elements, rather than just for keyboard typing.
I have fought this issue for over four hours. The recommended answer, hideKeyboardAccessoryBar(false) failed repeatedly, with every possible combination of cordova.Keyboard, windows.Keyboard, $window.cordova.Keyboard, yes, inside deviceready, etc. etc. Resolved all conflicts between this and the older plugin.
No joy.
Solution: REMOVE THIS PLUGIN. Guess what. You get your Done button back. Run the following command:
ionic cordova plugin remove cordova-plugin-ionic-keyboard
Solution: Remove this plugin!
sudo cordova plugin remove ionic-plugin-keyboard.
This is what worked for me since I needed the accessory bar only in one instance, the accepted answer is old, and I am using cordova-plugin-keyboard instead. I used it with an onOpen handler.
if (window.Keyboard) {
window.Keyboard.hideFormAccessoryBar(false);
}
I solved when put this line on config.xml:
<preference name="HideKeyboardFormAccessoryBar" value="false" />

HTML/CSS form field with suggestion

What is it called or where can I find code for placing a 'suggestion' or grayed out text in a form field box that doesn't get pass as a value. I know i can prepopulate it, but want to use it to only provide guidance. Example, box that says " "
The terminology you're referring to is called a watermark.
There are many existing Javascript solutions written for this already, like this one.
JavaScript will do this. I've used the jQuery framework, for example:
Setting the value:
$('#comment_box').val('Optional comment..');
On click, removing the value:
$('#comment_box').val('');
On submit:
if (comment == 'Optional comment..'){
comment = '';
}
And submit your comment. I've left out the functions here but you can get an idea.
HTML5 has a placeholder attribute supported by many modern browsers.
(But alas not MSIE.)
The above-linked article explains how to test for support and implement a javascript fallback.
use
<input type=text disabled value='...'/>
(disabled wont pass the values, whereas readonly will pass the value)
I think what you are referring to is a watermark
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/TextBoxWatermark/TextBoxWatermark.aspx
or
there are jquery defaultvalue plugins

are scala's mouse events working? how?

I'm trying to create link-like label in scala. But no mouse events works for me. How are they supposed to work?
class Hyperlink extends Label{
text = "hyperlink"
reactions += {
case MouseClicked(_,_,_,_,_) =>
println("mouse clicked")}}
I put this in some panel and click over the label like a pro minesweeper player... and nothing shows up in console. Why?
You need to listenTo the relevant thing, something like:
listenTo(this.mouse.clicks)
Edit: since 2.8.0 Mouse is deprecated, use mouse instead
Maybe this should have been a comment to the previous answer, but due to my rep, i cant add comments.
this.Mouse is deprecated and this.mouse should be used instead. Also, this might be a good resource: http://www.scala-lang.org/sid/8