lundi 23 mai 2016

How do I achieve this functionality in python?

I am writing automated UI tests in python and run by py.test. I am trying to make it as simple as possible for anybody who is writing tests. What I am trying to achieve is something like this.

def test_set_feature_example(self, fix_web_ui)
     A = fix_web_ui["features"]
     A.features.example = 'somestring' # What this should achieve is using selenium, set the text with the id 'features.example' with 'somestring'. 

What this should achieve is using selenium, set the text with the id 'features.example' with 'somestring'. The ids in the UI are same as the one mentioned. This is possible if I can override the operator '='. Since that is not possible, is there any other way that I can achieve this sort of functionality. The other way that I thought is adding these functionality in the finalizer of fix_web_ui but that wouldn't work because that would mean restricting the fix_web_ui to a function. Any ideas please? Hope I am clear.

Aucun commentaire:

Enregistrer un commentaire