Open arielelkin opened 1 year ago
It's possible that get text
is retrieving the label attribute. You could try using the get attribute
command and getting the value
attribute instead? Just a thought. I haven't used this driver before.
I've tried following your suggestion in a couple of ways.
my_label = driver.find_element(by=AppiumBy.CLASS_NAME, value='XCUIElementTypeStaticText')
assert(my_label.value == "Hello, world!")
Produces this error message
FAILED tester.py::test_edit_text - AttributeError: 'WebElement' object has no attribute 'value'
my_label = driver.find_element(by=AppiumBy.CLASS_NAME, value='XCUIElementTypeStaticText')
assert(my_label.get_attribute('text') == "Hello, world!")
Produces this error message
FAILED tester.py::test_edit_text - selenium.common.exceptions.InvalidArgumentException: Message: The att...
did you try
my_label.get_attribute('value`)
?
my_label = driver.find_element(by=AppiumBy.CLASS_NAME, value='XCUIElementTypeStaticText')
assert(my_label.get_attribute('value') == "Hello, world!")
Produces this error:
FAILED tester.py::test_edit_text - AssertionError: assert 'AppiumTestApp' == 'Hello, world!'
Which is weird, it looks like driver.find_element(by=AppiumBy.CLASS_NAME, value='XCUIElementTypeStaticText')
retrieves the entire app?
That doesn't seem right unless your app has accessibility text configured incorrectly. @mykola-mokhnach I'm not sure where to go from here given I don't use this driver. Any ideas on your end?
I don't see any issues there. We display exactly what XCTest returns to us. If some values are not present then either a wrong element is located or XCTest fetches unexpected values for it
@jlipps @mykola-mokhnach
The app I'm testing is just Xcode's macOS App template, but it's as bare-bones as can be (except for the TextField I've added but which really shouldn't be interfering)
Are you able to reproduce the issue? Here's the small demo app: https://github.com/arielelkin/macostestapp
@jlipps @mykola-mokhnach following up on this 😃
I was wondering if you were able to reproduce the issue? Or have any suggestions as to why the XCUIElementTypeStaticText
identifier isn't working..
I'm trying to assert that the text in the label says "Hello, world!"
This fails with the following error:
But the textfield is definitely in the page source!
Here's the very small demo app I'm trying to test: https://github.com/arielelkin/macostestapp