Clear elements is not working

Hi guys, how are you doing?

I can’t clear text fields in Appium, nor in tests nor in the Appium Inspector.

We’re using a very basic method, like this (they’re Ruby tests for iOS):

find_element(:accessibility_id, ‘Instance URL’).clear

We’ve been struggling with issues since the newest Xcode update so I wouldn’t be surprised if this is caused by some change in XCUI.

I’ve also noted that the Appium Inspector also fails in clearing elements; when tapping on ‘Clear’ the inspector loads but the text remains the same, as opposed to ‘Send keys’ that is working without any problems.

Any ideas on how we can tackle this!

Thanks in advance!
Octavio

Make sure the locator targets the correct element. It is possible the page source has changed after Xcode update

Hi Mykola, I’m sure it’s the same element since I’m testing to clear the element first and then write on it. What happens is the old text remains and the new text is added right after it, so instead of erasing ‘word1’ to write ‘word2’ the field currently shows ‘word1word2’ and it breaks the test. I’ve also checked it on the Inspector and can confirm the element is correct.

Do you mind attaching the actual page source?

it also makes sense to try appium@beta, since we did several fixes to the cleanup algorithm

Sure!

  def set_instance (instance)
    if button_exists("Let's go mobile!")
      find_element(:accessibility_id, 'Instance URL').clear
      find_element(:accessibility_id, 'Instance URL').type(instance)
      PageUtils.tap_button "Let's go mobile!"
    end
  end

Pardon my ignorance, how can I download the beta? Something like npm install appium (I’m on macOS) ?

Regards!

npm i -g appium@beta

2 Likes

I’ve tried with beta and the bug persists. I tried another method that also uses clear and none of them are working.

We still did not see the page source though