Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python中使用相似开关大小写清除文本字段_Python_Dictionary_Selenium Webdriver_Switch Statement - Fatal编程技术网

如何在python中使用相似开关大小写清除文本字段

如何在python中使用相似开关大小写清除文本字段,python,dictionary,selenium-webdriver,switch-statement,Python,Dictionary,Selenium Webdriver,Switch Statement,清除文本无效。我做得对吗?如何修复它?看起来您的逻辑顺序不对。您可能应该将字段传递到切换器字典,然后将该字段的值传递到按\u id查找\u元素 def test03_existing_company_validation(self): company = CompanyPage(self.driver) company.clear_text('company') 似乎您应该将字段传递到切换器字典,然后将该字段的值传递到按\u id查找\u元素。

清除文本无效。我做得对吗?如何修复它?

看起来您的逻辑顺序不对。您可能应该将
字段
传递到切换器字典,然后将该字段的值传递到
按\u id查找\u元素

    def test03_existing_company_validation(self):
        company = CompanyPage(self.driver)
        company.clear_text('company')

似乎您应该将
字段
传递到切换器字典,然后将该字段的值传递到
按\u id查找\u元素
    def test03_existing_company_validation(self):
        company = CompanyPage(self.driver)
        company.clear_text('company')
self.driver.find_element_by_id(switcher[field]).clear()