I'm using Appium/WebDriverIO/MacOS to test a React-Native project (it runs on MacOS). I haven't been able to figure out the correct selector to use to find a UI element.
For a React functional component, what prop will I have to set on it to be able to select it? And how can I select it from the tests itself?
I've tried using WebDriverIO's $ selector, but it hasn't worked, saying the locator strategy is not supported for this session
$ != selector
$ is a short form of findElement , what selector strategy to use depends on what format you use:
example, $('~someaccessibilityid')
https://webdriver.io/docs/selectors/
Note: See what all selectors the underlying driver or server like appium supports and use it. For example winappdriver doesn't support css , so you cannot use css strategy
read this to know all available selector strategy
Related
I want to know if there is a way to get the actual locale of the browser where my component is running (en-EN, es-ES,ru-RU,etc...) so that I can test the different locales of a file I have there.
this is how i know how to do it: Services.appShell.hiddenDOMWindow.navigator.language
I am basically executing the following luna-send command and trying to get those parameters from applicationManager:
luna-send -n 1 palm://com.palm.power/timeout/set '{"wakeup":true, "key":"myKey",
"uri":"palm://com.palm.applicationManager/launch","params":{"id":"com.my.app",
"params":{"test":true,"test1:true}},"in":"00:00:15"}'
After executing this command, my app gets launched by applicationManager, but I don't know how to get those params in my app. I am using enyo 2.0. I was trying to use onWindowsParamsChange handler, but ApplicationEvents is deprecated for 2.0. Can anyone help me with this?
Thanks
Under Enyo 1.0 it was enyo.windowParams. Under Enyo 2.0 I believe this functionality is gone. These parameters may be available through Cordova, but I'm not positive right now as I don't have the source handy. In any case, this was loaded from PalmSystem.launchParams so you should be able to access that.
If you're handling relaunch then you'll have a little more work to do. I think you'll need to define a Mojo.relaunch on the window object to detect when the launch parameters change.
I'm writing some tests for our web application. When I use this XPath inside the Firefox XPath-Checker plugin it just works fine:
//div[contains(#class, "my-class") and #data-custom-attr="id")]
But If use this in selenium code like so:
(new WebDriverWait(driver, MAX_TIMEOUT_FOR_ELEMENT_LOADING_IN_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[contains(#class, \"my-class\") and #data-custom-attr=\"id\")]"));
a timeout exception is throwen.
Why does the xpath query works directly in the browser but not in the selenium test? Is there documentation on what I have to consider?
As side note: if I use the exact path /html/body/div/... etc. it does work. And a css selector pendant to my example above doesn't work either.
It should work, what's the max wait time you given in code.
I've found code sample for google autocomplete and created other components for Bing and other search providers, but I can't switch autocompletion. I use following code to change autocompletesearch, but it doesn't work. Component works only if I define autocompletesearch property in XUL.
textbox.setAttribute("autocompletesearch", engine + "-autocomplete");
Worked around that problem by cloning and replacing input field each time I need to change autocomplete source.
From reading the Selenium documentation, I can see that there is a "newPageLoaded" flag that gets set when you perform a page-loading action. I'm trying to find out if there's a way to get at the value of that flag as the page is loading.
How to do this using the Ruby client would be great. : )
Can you try something like this?
selenium.getEval("selenium.browserbot.isNewPageLoaded()");