Giter VIP home page Giter VIP logo

Comments (5)

ctrevarthen avatar ctrevarthen commented on July 20, 2024 1

Glad to hear it, Dan!

Mobile.setText has been flaky in my experience, so I wasn't sure if it would work. Mobile.sendKeys is a little more reliable, but it requires the field to have been tapped and the keyboard to be open. The underlying code for TextField.typeText uses Mobile.sendKeys, and does those steps for you, if you provide a text input type of object.

from katalon-mobile-util.

ctrevarthen avatar ctrevarthen commented on July 20, 2024

Hi Dan, thanks for reaching out.

typeText works best for typing text into a TextView, so I'm thinking that in your case, using a text field with a picker might be more applicable. Here's the section of the README that talks about that: https://github.com/detroit-labs/katalon-mobile-util#using-a-textfield-with-a-picker-list

If that doesn't work, there is some logging that you can turn on to see what's going on. Check out this section on logging in the util: https://github.com/detroit-labs/katalon-mobile-util#logging

If you can send me that log file, it might help troubleshoot further.

  • Chris

from katalon-mobile-util.

Danbown avatar Danbown commented on July 20, 2024

Hi Chris
I have the following code in my script:
import com.detroitlabs.katalonmobileutil.logging.Logger as Logger
import com.detroitlabs.katalonmobileutil.logging.Logger.LogLevel as LogLevel
Logger.initialize("tmp\katalon.log", LogLevel.DEBUG)
Logger.debug('This DEBUG message will be logged to the file.')
Logger.info('This INFO message will be logged to the file.')
Logger.warn('This WARN message will be logged to the file.')
Logger.error('This ERROR message will be logged to the file.')
Logger.fatal('This FATAL message will be logged to the file.')

I run the script but all I get is a file with this:
Initializing log: 2020-05-27 12:31:44 with logging level: DEBUG
[DEBUG] 2020-05-27 12:31:44: This DEBUG message will be logged to the file.
[INFO] 2020-05-27 12:31:44: This INFO message will be logged to the file.
[WARN] 2020-05-27 12:31:44: This WARN message will be logged to the file.
[ERROR] 2020-05-27 12:31:44: This ERROR message will be logged to the file.
[FATAL] 2020-05-27 12:31:44: This FATAL message will be logged to the file.
I am currently running KS, rather than KSE if this makes a difference.

A screenshot of the application is below:
image
The orange label points to the 'view.View' element I want to set to a value for eg 'Yes'.
The user would normally click the dropdown to see this picker.
They then move the picker to set focus on the value (between the lines shown). This is the green callout shown.
They then click the dropdown again to keep the selection, at which point the 'view.View' element changes to 'text'='Yes'.
The blue callout is the 'picker' xpath.

I used 'typeText' to try to set the value directly in the 'view.View' element. What this does is replicate clicking the dropdown (to see option), scroll, move the picker options to a choice. The problem that I faced was that choices made were inconsistent - the list would scroll but not always choose right value.
When I tried 'TextField.selectOption' instead of 'typeText', the picker options were displayed but no selection was made - the picker did not scroll at all.

I also tried to make the selection by changing the element indicated with the green callout. This did not scroll the list at all either. The green callout points to a 'widget.button' Android class.

I'm unsure whether I need to try to make the 'widget.button' value change, or the 'view.View' value.
Thanks Dan

from katalon-mobile-util.

ctrevarthen avatar ctrevarthen commented on July 20, 2024

Hi Dan, thanks for the details!

Sorry if I missed this part, but have you tried creating the TestObject from //android.view.ViewGroup[@content-desc="Have previous survey details been reviewed?"]/android.widget.TextView (the text field specifically) and using TextField.typeText or even the Katalon built-in Mobile.setText on that? It might not work if the TextView is static text, but it could be worth a shot.

In the meantime, I'll look into ways to add more debugging to the calls you're trying, so we can log out what's going on.

from katalon-mobile-util.

Danbown avatar Danbown commented on July 20, 2024

Hi Chris
I think you have solved it! Thank you for the advice - I will also trial with a more complex page with more dropdown options but experimenting with using Textfield.typeText against what I assumed were just static labels (android.widget.TextView) has given the right result. Just to mention as well, Mobile.setText was tried but unsuccessful but I'm more than happy to use the custom option. Thanks again, Dan

from katalon-mobile-util.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.