Help, my test keeps Passing but should fail (strange I know)

Hi
In Katalon studio when I execute the below script if passes. The purpose of the test case if to scroll to each question in a form and check a radio button. I have been able to get the test to scroll to question 4., wait for radio button and check a radio button, the test will scroll up and down to question 5. correctly. however it does not check the radio button. I have also tried using both if verify checked and not checked, if not check then check else scroll to… either way fails the test, I added delays so I could visually confirm while building this test case that the radio button were being checked.
I have questions up to 20 to be added to this case which is why it is not closed yet.
the radio button object is correct as it works in the first instance and is the same through out all questions however the Check element does not work after question 4 and the if statements do not provide the check either.

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.testcase.TestCase as TestCase

import com.kms.katalon.core.testdata.TestData as TestData

import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW

import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

import internal.GlobalVariable as GlobalVariable

import org.openqa.selenium.Keys as Keys

WebUI.callTestCase(findTestCase(‘AA_Reusables/Android_Startup_Logon_GeeOggle’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase(‘AA_Resuseable_Test_Steps/Android_Forms_Open_CandidateAssessment’), [:], FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Object Repository/Android_MSFMEDCOLL/android.widget.CheckBox - History’), 0)

Mobile.tap(findTestObject(‘Object Repository/Android_MSFMEDCOLL/android.widget.CheckBox - Clinical Judgement’), 0)

Mobile.tap(findTestObject(‘Object Repository/Android_MSFMEDCOLL/android.widget.CheckBox - Physical Examination’), 0)

Mobile.scrollToText(‘4. Communicates well with patients’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 5)

Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 0)

Mobile.delay(2, FailureHandling.STOP_ON_FAILURE)

// Check if ‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’ is not checked

//if (Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 0)) {

//Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 5)

//} else {

Mobile.scrollToText(‘5. Reaches the correct diagnosis in a timely manner’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 5)

Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 0)

Mobile.delay(2, FailureHandling.STOP_ON_FAILURE)

// Check if ‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’ is not checked

//if (Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 0)) {

//Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton - 3 - At Expected level’), 5)

//} else {

Mobile.scrollToText(‘6. Refers patients appropriately’)

Hello, Still you are facing issue, or its solved ?

I just recently had a situation in which I couldn’t get radio buttons to click and what I did to resolve the issue was to delete the radio buttons in the OR and then recreated new objects with the same name. The new radio buttons worked. Don’t know why they previously didn’t but I quickly moved on.
Edit: what I think was that I could not see whatever was incorrect, but when recreating the object I fixed the mistake.

HI,
yes still facing the issue
I have updated the radiobutton xpath this will get checked but not everytime
I have added in a verification however this also does not seem to work consistently It is no longer passing the test, but now i cannot get the verification checkelement to be robust
updated script
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.util.internal.PathUtil as PathUtil

WebUI.callTestCase(findTestCase(‘AA_Reusables/Android_Startup_Logon’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase(‘AA_Resuseable_Test_Steps/Android_Forms_Open_CandidateAssessment’), [:], FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Forms/android.widget.CheckBox - History’), 0)

Mobile.tap(findTestObject(‘Mobile_Android/Forms/android.widget.CheckBox - Clinical Judgement’), 0)

Mobile.scrollToText(‘4. Communicates well with patients’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10, FailureHandling.STOP_ON_FAILURE)

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10)

Mobile.scrollToText(‘5. Reaches the correct diagnosis in a timely manner’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘6. Refers patients appropriately’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)

}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘7. Provides appropriate information for colleagues to provide follow-up patient care’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)

}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘8. Accepts responsibility for care of ongoing issues’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)

}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘9. Provides pertinent and timely information about patients when required’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)

}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘10. Recognises and takes action when urgent intervention is required’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)

}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘11. Takes responsibility for actions and decisions’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)

}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘12. Demonstrates apprioriate clinical judgement’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘13. Maintains patient confidentiality’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘14. Works well with collegues’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘15. Speaks respectfully of collegues in converrsations with patients and co-workers’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘16. Documents care appropriately’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}
Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘17. Is willing to take responsibility for error’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘18. Contributes to administrative practices supporting good medical care (office protocols, timely reports / information flow’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘19. Writes prescriptions and orders clearly’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}
Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘20. Appears committed to and current with advances in medical education’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5, FailureHandling.STOP_ON_FAILURE)

if (!(Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10))) {
Mobile.checkElement(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 0)
}

Mobile.scrollToText(‘Global rating’, FailureHandling.STOP_ON_FAILURE)

Mobile.checkElement(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.RadioButton - Competent’), 10)

Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 5)

Mobile.scrollToText(‘Assessor comments’, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.waitForElementPresent(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.AssessorComments_EditTextbox’),
10)

Mobile.setText(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.AssessorComments_EditTextbox’), ‘This candidate Passes’,
10)

Mobile.setText(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.view.View - 23. Feedback time’), ‘10.00’, 10)

Mobile.setText(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.view.View - 24. Observation time’), ‘9.00’, 10)

Mobile.tap(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.Button - Continue’), 0)

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.longPress(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.ImageLongPress’), 0, FailureHandling.STOP_ON_FAILURE)

Hi - yes I have update object, to give a random selection which works on occasionally but not consistently

I am currently in another zoom meeting, is there another way we can put out heads together?

1 Like

I have looked at your code some and I noticed a few things.

  1. For your first two statements in your code above, you can change the WebUI to Mobile just to be consistent.
Mobile.callTestCase(findTestCase('AA_Reusables/Android_Startup_Logon'), [:], FailureHandling.STOP_ON_FAILURE)

Mobile.callTestCase(findTestCase('AA_Resuseable_Test_Steps/Android_Forms_Open_CandidateAssessment'), [:], FailureHandling.STOP_ON_FAILURE)
  1. When I see someone with a timeout of zero, like I quote above, I see someone that doesn’t realize the multitude of events your computer is doing behind the scenes. Check with your Task Manager on your computer, and then change the “timeout” to 5 or 10–on all fifteen of them. I personally have mine set to 10 except when I have a verifyNot… for which I set at 3. This could be the source of your concern as well.
Mobile.checkElement(findTestObject('Android_MSFMEDCOLL/Ninas_RadioButton_Any'), 10)
  1. Whenever you place code in this forum, you should put 3 backticks (like: ``` ) on a line above the code and 3 backticks on a line below the code. This will display the code better, like I have done above. The backtick is on the same key as the tilde ( ~ ) in the upper left of the keyboard.

Hi there @nina, :wave:

Thank you for being a part of Katalon Community!

From time to time, other members may offer to support you directly via Skype or Zoom, and we would like to let you know that if you accept such offers, you will be doing so at your own risk.

This is because we cannot guarantee the quality, accuracy, or reliability of the “support” that you receive from such members. Plus, when you detail your questions on our forum, you not only going to get support from other members, but also our team as well, and we can validate each other’s advice/suggestions until we reach one that resolvea your issue.

Therefore, always use caution and common sense when dealing with them, and remember to report any scam or suspicious activity to us immediately by sending a message to @team.

Thanks and happy testing! :sunglasses:

Thank you, for the advice… does anyone on the team have some help for my issue?

Thank you grylion54 for the suggestions I have implemented

1 Like

Hi, update on test results
I the test is not no longer passing due to the Radio button not being checked/tapped
I have tried both mobile.tap and mobile.checkelement for some reason the mobile.tap gives a higher percentage of radio buttons actually being checked.

When executing the test the scrolltotext works however the tap or check radio button does not always work, and gives different results (as in which buttons are checked) each time the test is run.
I tried verifyelementchecked but this did not result in any of the unchecked radio buttons being checked so have tried the getattribute have no idea if this is working or not, but getting a higher rate of checks.

I am new and I do not know where to turn next to ensure that a radio button is selected at each question (which is represented in the script below by the ScrolltoText)

‘’'WebUI.callTestCase(findTestCase(‘AA_Reusables/Android_Startup_Logon’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.callTestCase(findTestCase(‘AA_Resuseable_Test_Steps/Android_Forms_Open_CandidateAssessment’), [:], FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Forms/android.widget.CheckBox - History’), 0)

Mobile.tap(findTestObject(‘Mobile_Android/Forms/android.widget.CheckBox - Clinical Judgement’), 0)

//Q4
Mobile.scrollToText(‘4. Communicates well with patients’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10, FailureHandling.STOP_ON_FAILURE)

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 10)

//Q5
Mobile.scrollToText(‘5. Reaches the correct diagnosis in a timely manner’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘6. Refers patients appropriately’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q6
Mobile.scrollToText(‘6. Refers patients appropriately’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘7. Provides appropriate information for colleagues to provide follow-up patient care’)
// If radiobutton is checked
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q7
Mobile.scrollToText(‘7. Provides appropriate information for colleagues to provide follow-up patient care’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘8. Accepts responsibility for care of ongoing issues’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q8
Mobile.scrollToText(‘8. Accepts responsibility for care of ongoing issues’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘9. Provides pertinent and timely information about patients when required’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q9
Mobile.scrollToText(‘9. Provides pertinent and timely information about patients when required’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘10. Recognises and takes action when urgent intervention is required’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q10
Mobile.scrollToText(‘10. Recognises and takes action when urgent intervention is required’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘11. Takes responsibility for actions and decisions’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q11
Mobile.scrollToText(‘11. Takes responsibility for actions and decisions’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘12. Demonstrates apprioriate clinical judgement’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q12
Mobile.scrollToText(‘12. Demonstrates apprioriate clinical judgement’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘13. Maintains patient confidentiality’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q13
Mobile.scrollToText(‘13. Maintains patient confidentiality’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘14. Works well with collegues’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q14
Mobile.scrollToText(‘14. Works well with collegues’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘15. Speaks respectfully of collegues in converrsations with patients and co-workers’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q15
Mobile.scrollToText(‘15. Speaks respectfully of collegues in converrsations with patients and co-workers’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘16. Documents care appropriately’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q16
Mobile.scrollToText(‘16. Documents care appropriately’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘17. Is willing to take responsibility for error’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q17
Mobile.scrollToText(‘17. Is willing to take responsibility for error’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘18. Contributes to administrative practices supporting good medical care (office protocols, timely reports / information flow’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q18
Mobile.scrollToText(‘18. Contributes to administrative practices supporting good medical care (office protocols, timely reports / information flow’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘19. Writes prescriptions and orders clearly’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q19
Mobile.scrollToText(‘19. Writes prescriptions and orders clearly’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘20. Appears committed to and current with advances in medical education’) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

//Q20
Mobile.scrollToText(‘20. Appears committed to and current with advances in medical education’)

Mobile.waitForElementPresent(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15, FailureHandling.STOP_ON_FAILURE)

Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

checkedAttribute = Mobile.getAttribute(findTestObject(‘Object Repository/Android_MSFMEDCOLL/Ninas_RadioButton_Any’), ‘checked’,
15)

if (checkedAttribute == ‘true’) {
Mobile.scrollToText(‘Global rating’, FailureHandling.STOP_ON_FAILURE) // If radiobutton is checked
// Handle the failure or add additional steps here
} else {
Mobile.tap(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)
}

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.scrollToText(‘Global rating’, FailureHandling.STOP_ON_FAILURE)

Mobile.checkElement(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.RadioButton - Competent’), 10)

Mobile.verifyElementChecked(findTestObject(‘Android_MSFMEDCOLL/Ninas_RadioButton_Any’), 15)

Mobile.scrollToText(‘Assessor comments’, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.waitForElementPresent(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.AssessorComments_EditTextbox’),
10)

Mobile.setText(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.AssessorComments_EditTextbox’), ‘This candidate Passes’,
10)

Mobile.setText(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.view.View - 23. Feedback time’), ‘10.00’, 10)

Mobile.setText(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.view.View - 24. Observation time’), ‘9.00’, 10)

Mobile.tap(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.Button - Continue’), 10)

Mobile.delay(3, FailureHandling.STOP_ON_FAILURE)

Mobile.longPress(findTestObject(‘Mobile_Android/Forms/FinaliseForm/android.widget.ImageLongPress’), 10, FailureHandling.STOP_ON_FAILURE)‘’’

Sorry, @nina, but in the above quoted statements:

  1. you still have the timeout of the bottom two Mobile “tap” statements at zero. You should change them to 10 instead,
  2. you still are using WebUI instead of Mobile (both will work but I just thought you would like to be consistent on a Mobile project),
  3. it looks like you are using 3 single quotes instead of 3 backticks like I stated (again: ``` which on my keyboard is right above the TAB key and beside the 1 key) and you put the single quotes on the same line as your code instead of above your code (on a line by itself) and below your code on a line by itself,

Is the text that you are moving to at the same level on the screen as the checkbox? If it is, is there a means that you can get the checkbox to be within the viewport of the screen?

HI @grylion54
the checkboxes you have on the page are working perfectly, however the radiobuttons are tapped inconsistently for example Q4 and Q5 radiobutton will be checked then Q6 and Q7 won’t be, the next time the test is run different questions radiobutton will be checked

@Russ_Thomas
Who do we have on the List that knows about mobile-testing that might be able to help @nina more? I’m stumped.

Well, back in the dark ages, it used to be @Chris_Trevarthen but he hasn’t been around for a good while. @ThanhTo too but he hasn’t visited since March.

It’s a shame it didn’t get taken up by management and fostered better when I posted it, but this was my attempt to handle this kinda thing:

:cry:

Let’s hope the new community leaders can take this ball and run with it!

@albert.vu @vu.tran @mike.verinder

1 Like

@nina It looks like every time you look for the radio button you are using the same object. I am not sure what OS version you are doing the mobile testing on (there are some differences between os versions. Sometimes more objects are present than are visible on the screen) but think that likely there are multiple of the same radio button objects that are visible to the appium driver at the same time. I am not sure why it would be different every execution but if both Q4 and Q5 are visible, even if you have scrolled down to Q5 you will be finding the first object that matches all of the attributes. If one of the radio buttons from higher up on the screen is already checked your script probably won’t check another one.

The way I have dealt with radio buttons is to use relative object identifiers. So you can look for a unique identifier for each question and search only the child objects of that question for the specific radio button attached to that question and interact with that.

I would be happy to help more if I had an expanded mobile object capture of your device.