I am currently automating iOS Native application using Appium 1.6.x
Problem Statement:
I am not able to find whether a TableCell is selected or not in Appium 1.6.x XCUITest framework. [A tick mark displays in the application on selecting, but not able to find that in automation]. The element attribute is as follows:
Device : iPad 10.x / Appium 1.6.1
Type: XCUIElementTypeCell
Accessibility Id:
Value:
Label:
Is Visible: true
Rect: x=694, y=195, h=44, w=320
Absolute XPath:
/AppiumAUT/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther[2]/XCUIElementTypeOther[3]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell
The same application when I inspect using Older appium 1.5.x UIAutomation framework, I am able to find the TableCell is selected or not. The element attribute is as follows:
Device : iPad 8.x / Appium 1.4.3
Name: Management
type: UIATableCell
value: 1
label:
enabled: true
visible: false
valid: true
location: {694, 195}
size: {320, 44}
xpath: //UIAApplication[1]/UIAWindow[1]/UIAPopover[1]/UIATableView[1]/UIATableCell[1]
Do anyone know the problem exists because of XCUI Test Framework or due to any other changes?
Related
I am writing a series of appium mobile ui tests using ruby and executing the tests in BrowserStack. Here are my desired capabilities and appium initialization:
caps = {
"browserstack.user": ENV["BROWSERSTACK_USER"],
"browserstack.key": ENV["BROWSERSTACK_ACCESS_KEY"],
"browserstack.local": true,
platformName: "ios",
device: "iPhone 11",
os_version: "14",
app: myapp_ios,
project: "Product Name",
build: "Build ID #{build_id}",
name: "Some Test Case"
}
Appium::Driver.new({
caps: caps,
appium_lib: {
server_url: "http://hub-cloud.browserstack.com/wd/hub"
}
}, global_driver: true)
When I initialize Appium, I get this message
Use myapp_ios directly since /Users/kroe761/Documents/Automation/Automation-Projects/myapp-tests-automation/myapp_ios does not exist.
This doesn't affect the test at all, but I write automation for manual app testers and I want to clean up the terminal output as much as possible so they only see what they need to see. The app desired cap is the custom id I gave my app when I uploaded it to BrowserStack, so it obviously doesn't exist on my file system.
Thank you!
It should point to the ipa file that you are planning to automate.
I'm exploring my Native App with Appium DeskTop. For an inputfield Appium Desktop is showing in the 'Find By Selector Window' an Id and a XPath expression.
When I recorded a Sendkeys action to this inputfield Appium DeskTop shows in the Recorder Window that the XPath expression is used to locate the Element instead of the Id. This is not what I expected, I expected the Id being used to locate the element.
I tried to use the Id in my Testprogram to locate the element, this is giving, when Explicit waiting for Visbilty of the Element, see C# code below:
wait.Until(ExpectedConditions.ElementIsVisible(By.Id("companyname")));
IWebElement bedrijf = (IWebElement)driver.FindElementById("companyname");
bedrijf.Click();
bedrijf.SendKeys("IBM");
Then the following exception appears:
OpenQA.Selenium.NoSuchElementException
What kind of an Id is presenting Appium Desktop here?
You need to use resource-id. For native android apps, usually id attribute is used as resource-id.
IWebElement bedrijf = (IWebElement)driver.findElement(By.xpath("//android.widget.EditText[#resource-id='companyname']"))
I need to select a colour in my acceptance tests. The hidden colour field is rendered with jquery-minicolors#2.1.10. I use the following code to set the colour:
find('#colour', visible: false).set('#fefacb')
I use capybara (3.11.1), selenium-webdriver (3.141.0) and ChromeDriver 2.44.609545 (c2f88692e98ce7233d2df7c724465ecacfe74df5). I run the tests in headless mode
But my test fails with:
element not interactable
(Session info: chrome=70.0.3538.110)
(Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.14.1 x86_64) (Selenium::WebDriver::Error::ElementNotVisibleError)
What is wrong with my code? How can I fix it?
Just like a user wouldn't be able to, you can't interact (set, click, etc) with non-visible fields. Instead you need to interact with the visible elements on the page created by jquery-minicolors -- What those elements would be is completely dependent on how you've configured jquery-minicolors but should be relatively obvious by inspecting the page.
Using Intern JS with WebDirver to communicate with Appium 1.4.1, I have a simple functional test, part of which should find a text input box on the login screen of our iOS app, tap into it and type the user's login name:
define([
'intern!object',
'intern/chai!assert',
'require'
], function (registerSuite, assert, require) {
registerSuite({
name: 'Suite Name',
'Login Screen': function () {
return this.remote
.setFindTimeout(50000)
.findByXpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/UIATextField[1]")
.tap()
.type('student1#demo.com')
.end()
.then(function (pagetitle) {
assert.strictEqual(pagetitle, 'DEMO COLLEGE',
'Should land on app dashboard with school title displayed');
});
}
});
});
When executed using intern-runner everything appears to go well, Appium launches our app and awaits my input - but no matter what I try I can't find the element I need to type into using Leadfoot's findByXpath:
$ intern-runner config=tests/appium
Listening on 0.0.0.0:9000
Starting tunnel...
Initialised iOS on MAC 8.1
Test main - Suite Name - Login Screen FAILED on iOS on MAC 8.1:
NoSuchElement: [POST http://[appium-server-address]:4723/wd/hub/session/80e20453-452e-4181-8713-4f9e0cfa427f/element / {"using":"xpath","value":"//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/UIATextField[1]"}] An element could not be located on the page using the given search parameters.
at Server._post <../../.nvm/v0.10.35/lib/node_modules/intern/node_modules/leadfoot/Server.js:68:9>
Using Appium's GUI "inspector" I've confirmed the Xpath to the text-input-box element is:
"//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/UIATextField[1]"
Can anyone suggest where I'm going wrong please?
Looks like the Appium Inspector tool on my Mac was duplicating part of the path?
.findByXPath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/**UIATextField[1]**")
.type("wibble")
Remove the duplicated element in bold (the final UIATextField[1]) ....
.findByXPath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/**UIATextField[1]**")
.type("wibble")
And it works.
Thanks Appium Inspector. Thanks a lot.
I have been trying to run some sample Remote WebDriver tests on the Safari browser on the IOS Simulator 7.0 (IPhone) but my tests give an exception every time I try to type in values on a text box. Just trying to use the example from iosdriver
DesiredCapabilities safari = IOSCapabilities.iphone("Safari");
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://<someip>:4444/wd/hub"), safari);
driver.get("http://hp.mobileweb.ebay.co.uk/home");
WebElement search = driver.findElement(By.id("srchDv"));
search.sendKeys("ipod");
search.submit();
gives me the exception
a "org.openqa.selenium.NoSuchElementException: cannot find element for criteria :{"AND":[{"l10n":"none","expected":"UIAElement","matching":"exact","method":"type"},{"l10n":"none","expected":"Address","matching":"exact","method":"name"}" .
Anyone else run into this? It is identifying the element but typing in values fail..It works fine when I try it on firefox on my desktop.
I am no expert, but am familiar with selenium webdriver..
Are you sure that the id for "search " --- ('srchDv') actually exists on the page you are trying to automate?
if so
i would then look into the UIA -Element Hierarchy / Accessibility link to UIA Element Class reference
Hope this is helpful
You have an incorrect selector. The page you are automating does not have an id srchDv. If you are getting the search box, then you need to use:
driver.findElement(By.id("gh-ac")).clear();
driver.findElement(By.id("gh-ac")).sendKeys("ipod");
Also, instead of using submit, personally i would follow the way that your user would commit the action, and that's by clicking the search button.
driver.findElement(By.id("gh-btn")).click();