Home > Mobile >  What is the correct way to update an element in elements list?
What is the correct way to update an element in elements list?

Time:01-10

I created a list of elements and I want to update one of the list elements

This is the call to the update method:

companies_list = self.create_list("xpath", self.txt_company_name)
self.update_elem(companies_list[0], company1_name)

And this is the update method:

def update_elem(self, elem, text):
    elem.send_keys(text)

At the method I'm getting warning "Make function from method" and a suggestion "Method 'update_elem' may be 'static'"

What is the correct way to update the list element without getting warnings?

CodePudding user response:

Basically, Pycharm thinks you wanted to declare the 'update_elem' as static as it does not change in the body of the method the class instance.

take a look at this answer

  •  Tags:  
  • Related