'How to enter a value to a textbox from an external excel or YAML file in Appium?
I'm aware of the fact that it is possible to enter a value to a text box using Appium sendkeys.
Is it possible to pass values from an external excel or YAML file to these textboxes?
For example, I need to pass values to UN and PW text fields, so I use
self.driver.find_element_by_xpath('//*[contains(@text,"UserName") and contains(@class, "android.widget.EditText")]').send_keys("User@1234")
self.driver.find_element_by_xpath('//*[contains(@text,"Password") and contains(@class, "android.widget.EditText")]').send_keys("1234")
I have a YAML file which contains various combinations of UN and PW for different test scenarios.
Row1:
username: User@1234
password: 1234
Row2:
username: User@523
password: qaz@143
How can I pass these values to the desires UN and PW text fields?
Solution 1:[1]
Is it possible to pass values from an external excel or YAML file to these textboxes?
Yes. Python is able to extract data from an Excel sheet using xlrd and from YAML using PyYAML, and you can send the extracted data with Send Keys.
If you have problems doing this and need help with that, you need to be a lot more precise about what you're doing, how your input data looks, what you've tried and what the problem is.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | flyx |