Posting the code snippet

for abc in self.driver.find_elements_by_xpath(
                        flag = False
                        for xyz in abc.find_elements_by_tag_name("div"):
                            attr = xyz.get_attribute("colid")
                            if attr == "moduleName":
                                module_name = cluster_module.text[:-3]

                                # Check in the module given in input file is found on UI
                                if module_name == input_module:
                                    logger.warning("Module {} found.....".format(input_module))
                                    flag = True
                                    logger.warning("Flag value {}".format(flag))
                            elif attr == "inventoryTarget":
                                if flag:


                                            .send_keys(Keys.CONTROL + "a").send_keys(Keys.DELETE)\

please note i have a suite with multiple test cases and each test case calls this function and it works for first testcase but fails after that for subsequent testcases

  • so what is the error you get? Commented Apr 2, 2019 at 14:06

2 Answers 2


Seems like the flag is not being set to true on consecutive runs. You should check the module names in your if statement:

if module_name == input_module

I do not know what those 'modules' are, but it seems like this condition is not met.


You can try using Appium Studio. It has simple commands which can be exported / directly coded in multiple languages. For double click it would be self.client.click("NATIVE", "your-xpath-here", 0, 2) The last parameter is the click count. Set it to 1 for single click. You can find here the detailed documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.