Application for "button" Other is not an accessory and is not frontmost - xctest

I have an xcuitest. But my tests fails often with the message
Application for "button" Other is not an accessory and is not frontmost
What could be the reason.
Any help appriciated

You have to make sure that your "button" is actually a button type. To make sure, put a breakpoint and type "po XCUIApplication()" in your xcode console.
Then find your element in the tree and check the type of your element.
You can also use the method "waitForElementToAppear" to make sure that your element is rendered and in frontmost.

Related

How to conditionally render an input accessory view?

I am trying to conditionally render an input bar that appears above the keyboard when the user is tying. I do not want to show this input bar unless the user wants to add something. So they tap a button which is supposed to make the component visible and then focus on the input which brings up the keyboard.
This works as expected except when the user first opens the keyboard. Nothing appears. There is an empty view tag as the keyboard comes up but then it disappears and there is nothing. However, once the user starts typing it appears and after that works as expected. I have no idea why it isn’t appearing. If I don’t type anything and dismiss the keyboard you can see it briefly before it goes away as it is supposed to.
I have tried calling the function with async-await and my current syntax. Neither is working and I have been unable to solve this.
Here is a snack that recreates the issue and contains all the relevant code to reproduce the error.
https://snack.expo.io/#dmargulies/inputaccessoryview-problem
Thank you for your help.
First of all InputAccessoryView exists only on IOS.
I changed conditional rendering flow.
Look at: https://snack.expo.io/#djalik/inputaccessoryview-problem
For anyone looking for a cross-platform solution, there is a package:
react-native-keyboard-accessory
Note: I'm not the author, just figured it might help some peeps.

Cannot type into text input on jqModal dialog when modal set to true

Having upgraded jqModal from r13 to r22, I find that where my dialogs contain text inputs it is not possible to type into them. Removing modal:true from the settings fixes it, but I don't want my users to be able to dismiss the dialog by clicking on the overlay. Is this behaviour by design, or is it a bug?
This is certainly not by design. I have released a fix (+r23). Please open a github issue if you require further assistance.
Related:
If you're nesting modals, be sure to have a higher z-index value on child modals.
You may override the $.jqm.focusFunc() to provide custom behaviour for events occurring outside the currently active modal.

element present but hidden selenium check

How can I check if an HTML element is hidden (display:none:) with selenium IDE?
In my case the html is a button and I want selenium to announce me if the element is hidden.
If I use verifyElementPresent, selenium will find the element although is hidden.
Thanks!
You can use any derivation of the storeVisible command.
Most notably, assertVisible and waitForVisible have been useful for me in the past.
if you want to check whether a HTML button is hidden or not just use command verifyvisible
command:verifyVisible
Target:id of the button
if your button is visible it will not throw error but if it not visible it will throw error
Thank You.

Closing frontmost window in Cocoa in an app without a menu bar

I am building a StatusBar App in Cocoa, therefore I have no menu. Having no menu implies not having a "File > Close" menu item, which normally listens to the shortcut "Command + W".
From my StatusBar App the user may open a window to change the preferences and that's where I'm running into problems: The user can only close the window by pressing the red dot with the mouse. However, like alle applications I want to support the "Command + W" shortcut as well.
At the moment I see two possibilities to solve this issue:
Place an invisible button on the window which listens to the shortcut.
Add an application-wide listener for the shortcut and contact the window manually.
Both solutions feel like a misuse of the system. The first solution can lead to unexpected behaviour (the window closes if the user hits the invisible button by chance) and the second solution will still result in a beep, since the window does not know that it handles such a shortcut.
Is there an elegant way to solve this problem? Since the view should know what to do, a solution with just Interface Builder would be perfect. If there is no elegant way, is there a way to enhance the solutions mentioned?
Thanks in advance!
If you put a File > Close menu item in your MainMenu nib, the shortcut will work, even though the menu isn't visible.
If you choose to implement an app-wide listener for the shortcut instead, you can get rid of the beep by returning nil from the block, so that the original event doesn't get passed on.

Use of 'ClickAt ' selenium command

I'm confused about the difference between the Click and ClickAt commands in selenium. Where can I use the ClickAt command?
Here are what Selenium IDE says about those two commands :
click(locator) Arguments:
locator : an element locator
Clicks on a link, button, checkbox or
radio button. If the click action
causes a new page to load (like a link
usually does), call waitForPageToLoad.
And :
clickAt(locator, coordString) Arguments:
locator : an element locator
coordString : specifies the x,y position (i.e. - 10,20) of the mouse
event relative to the element returned
by the locator.
Clicks on a link, button, checkbox or
radio button. If the click action
causes a new page to load (like a link
usually does), call waitForPageToLoad.
click is used when you just want to "click" on an element, like a button, a link, ...
And clickAt is used when you want to "click" on a position designated by mouse coordinates.
I suppose the second one can be useful for some "rich" applications -- I've actually never used it... On the other hand, I use click like all the time.
If you have a page with form elements, links, buttons, and stuff like that, you'll probably generally use click : it's way easier to find an element using it's id or classname than having to find it's position in pixels on the page ^^
I noticed some differences between click() and clickAt() when testing a ExtJS app.
For example, if I try to click a tab in a Ext.TabPanel, click() command does not work, although I provide it with an correct xpath, and clickAt() works fine.
Code looks like this:
click("//li[#id='tab-panel-id__second-tab-id']/a[2]/em/span/span")
doesn't work, but
clickAt("//li[#id='tab-panel-id__second-tab-id']/a[2]/em/span/span","0,0")
works.
Notice that coordinates are (0,0)
I can't figure out why this happens...
I'm testing a GWT application and it seems like I have to use clickAt if I want to click on a node in a tree widget.
Be careful when testing clickAt. Sometimes double clicking the command will cause it to show up red. You will change the line to try other alternatives but nothing will work. But then run your script and the clickAt line will be fine with whatever you type in.
There is a dojo widget at our application which only works with clickAt("//span[#id='mastheadIconBar']/span[1]/span/span","0,0").
Don't know why, but only click("//span[#id='mastheadIconBar']/span[1]/span/span") does not work.