Protractor - does anybody know how to click on element with RIGHT MOUSE BUTTON? - mouse

I know that protractor click on element by default with left mouse button. How to do it to click with RIGHT MOUSE BUTTON ?
el.click('RIGHT'); ?

I would have done like this:
browser.actions().mouseMove(el.find()).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
Based on what I saw in actionsequence.js and Protractor rightClick issue #280

The accepted solution for this question isn't the best way to go about this. Browser actions' .click() method accepts an optional arg for clicking the right button. A better solution, from the webdriverJs api is:
browser.actions()
.click($('.myElm'), protractor.Button.RIGHT)
.perform();

Try this:
el.sendKeys(protractor.Key.RIGHT)
Here is the list of keys:
https://code.google.com/p/selenium/source/browse/javascript/webdriver/key.js
If it doesn't work do this:
https://groups.google.com/forum/#!topic/selenium-users/fF_Hcp40KO0
Let me know if it works

Related

Long press an element to show the black options bubble(copy,forward..) like wtsapp?

Can someone point me to the right direction of how to show options(copy, forward...) when I long press an element (a message in this case) like wtsapp/FB messenger?
I don't even know what keywords should I be searching...(tried modal, popover, action sheet)
Thanks.
Update:
I understand that I should use the on-hold gesture...I am specifically looking for the black option bubble to be shown. I don't know what it is called(not modal/pop up/ action sheet/popover/alert). Thanks.
you can use on-hold="myFunction()", check the link below
http://ionicframework.com/docs/api/directive/onHold/
and then use the $ionicActionSheet Service to do your logic, check the link below
http://ionicframework.com/docs/api/service/$ionicActionSheet/
on-hold event is your friend : http://ionicframework.com/docs/api/directive/onHold/
I think following Codepen example would help in accomplishing what you want to do:
Actionsheet : http://codepen.io/ionic/pen/jLylA
Also, have a look this thread on Ionic Forum before you start implementing, just to avoid any similar issue, plus, this thread got some CodePen examples, that your might find useful :
https://forum.ionicframework.com/t/displaying-actionsheet-on-a-long-press-aka-hold-event-problem/5663
You can implement long press with either on-hold and if you want to implement long press for buttons, try this directive from this link and a note on directive can be found here . You may need to use a custom action sheet ($ionicActionSheet) to implement the UIMenuController (iOS component) like feature.
.selectable{
-webkit-user-select: auto;
}
for selection and ion-content to overflow-scroll="true"

Protractor : How to select an item from list when right-clicked

I am trying to Right click on an element and then select an option "Rename" from the list. I have got "right clicking" working but can't select option from the list. Referred links 1, 2
Note 1:
1: On right click the menu options that are visible are native context menus. So, they don't appear in my DOM that I can see.
2: The App runs only in Chrome browser(not sure if it is a browser issue)
I have tried the following code:
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.RIGHT).click(protractor.Button.ARROW_DOWN).click(protractor.Button.ARROW_DOWN).click(protractor.Button.ARROW_DOWN).perform();
Consider, "Rename" to be the third option in the list.
Note 2:
If I am just running the app and enter 'R' from my keyboard, it selects the "Rename" option. But when I tried to run it in my test, it doesn't select the "Rename" option. See below code I tried:
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.ARROW_RIGHT).sendKeys('R',protractor.Key.ENTER).perform();
None of the above code works. Let me know if more information is required.
EDIT:
I am guessing the following to be happening:
once I mouse over, the script "right clicks" and after that the "tooltip" is displayed. Since the "tooltip" is displayed after "right click" I think the menu list goes to the background(the list is still visible along with the tool-tip), which is why the arrow down keys aren't working. Is this possible? If yes, how can I wait for the tooltip to be invisible and then right click?
Input: I tried to wait for tool-tip to be invisible and then right click, but still the "Arrow_down" doesn't work.
Is there a way to bring the menu list in the front once we have right clicked?
IMPORTANT:
I took a screenshot after I right clicked on the element, and the screenshot doesn't show the "menu list". Below is the code for screenshot:
browser.actions().click(protractor.Button.RIGHT).perform()
.then(function() {
browser.takeScreenshot().then(function(screenShot) {
writeScreenShot(screenShot, "image.png");
});
});
//writeScreenShot takes two variables actual screenshot data and the file name. And the screenshot is saved as "image.png"
What needs to be done?
When you send ARROW keys to the browser, you have to send them as keys instead of passing them to click() function and the ARROW_DOWN key is part of Key object and not BUTTON. Here's how -
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.RIGHT).sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ARROW_DOWN).perform();
For your second try, you should send RIGHT in the place of protractor.Button.ARROW_RIGHT to right click. When you send two actions/keys to sendKeys() function, you have to join them using chord object which combines the action of pressing two keys at a time(ex: CTRL+C for copy). But in your case i don't think its really necessary. Here's how to use it -
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.RIGHT).sendKeys(protractor.Key.chord("r", protractor.Key.ENTER).perform(); //Not necessary as you wont be pressing R+ENTER in your keyboard
OR
browser.actions().click(protractor.Button.RIGHT).sendKeys('R').sendKeys(protractor.Key.ENTER).perform();
Hope this helps.
use XPath to solve your problem
browser.actions().mouseMove(target).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
element(by.xpath('//*[#id="context-menu"]/ul/li[1]')).click();
In your case it will be "//*[#id="context-menu"]/ul/li[3]" most probably.

using protractor mouseMove to click on a drop-down

I am using the following to get protractor to click on a drop-down menu.
ptor.actions().mouseMove(
ptor.findElement(protractor.By.xpath("//a[#tooltip='Portfolios']"))
).click();
However this does nothing which is to say that the drop-down does not get clicked and no errors are displayed.
What am I missing here ?
For the benefit of those who landed on this page. The solution is to use .perform at the end.
here is the working version
ptor.actions().mouseMove(
ptor.findElement(protractor.By.xpath("//a[#tooltip='Portfolios']"))
).click().perform();
Actually you don't have to use actions, with actions you can not select option that is not currently visible in the screen.
use this:
element(by.xpath("//a[#tooltip='Portfolios']")).click();
I suppose you should only use perform, like:
ptor.actions().mouseMove(
ptor.findElement(protractor.By.xpath("//a[#tooltip='Portfolios']"))
).perform();

disable back button on in ltk wizardinputpage

I'm doing a plugin in Eclipse IDE in order to do a refactoring. I'm using LTK, the point is: I don't know how I can disabled the back button after the preview. I've tried to create the RefactoringWizard using some flags like 'NO_BACK_BUTTON_ON_STATUS_DIALOG', but I think it is not the rigth way to do it.
The poblem I have in the background is that when I push preview and then push back, and preview again, the preview box shows the change related with the refactoring twice!.
I think the best solution is disabling the back button after the preview because this is the solution I have seen in others plugins.
Sorry because of my English and thanks beforehand.
The method org.eclipse.jface.wizard.WizardDialog#updateButtons disables the back button when currentPage.getPreviousPage() returns null. So, I suggest you to override the method org.eclipse.ltk.ui.refactoring.RefactoringWizard#getPreviousPage to return null.

Assigning Back button event to form button in android

i have a form button in the form,which i need to perform basic action performed by the back button in the android emulator.
I know the key even is KeyEvent.KEYCODE_BACK
how to assign this to my button.
thanks in advance.
The question isn't totally clear, but you probably just want to call finish() when your Button is clicked.
I found the solution to it.
call the function moveTaskToBack(true);
to get back to previous task.