خرید بک لینک

Vote count: 0

I am trying to use the Python Interpolation %s for my parameter variable. My variable is name and the value in this variable I would like to insert it where I have put %s

My code snippet is:

def select_dataset(self, name):
    # Params name: The name of the dataset e.g. CRM
    name_element = self.get_element(By.XPATH, '//table[@id="data_configuration_datasets_ct_fields_body"]/tbody/tr/td/div/span[@title="%s" and contains(text(), "%s")]/preceding::input[1]' % name % name).click()

The error is:

 Traceback (most recent call last):
  File "C:WebdriverClearCore Regression TestClearCore - Regression TestTestCasesDatasetsPage_TestCase.py", line 146, in test_a2_edit_datasets
    ds.select_dataset("Edit_test")
  File "C:WebdriverClearCore Regression TestClearCore - Regression TestPagesdatasets.py", line 281, in select_dataset
    name_element = self.get_element(By.XPATH, '//table[@id="data_configuration_datasets_ct_fields_body"]/tbody/tr/td/div/span[@title="%s" and contains(text(), "%s") % name]/preceding::input[1]' % name).click()
TypeError: not enough arguments for format string

The Test Case which calls the methed:

def test_a2_edit_datasets(self):
    print "*** Test edit_dataset ***"
    menu_bar = MenuBarPage(self.driver)
    tool_bar = ToolbarPage(self.driver)
    project_navigator = ProjectNavigatorPage(self.driver)
    ds = project_navigator.select_projectNavigator_item("Datasets")
    ds.click_add_datasets()
    time.sleep(1)
    ds.add_datasets_name_description_and_datamap("Edit_test", Globals.dataset_description) # adds the name, description and selects datamap drop down for the Dataset
    ds.add_name_type_and_size_for_key_fields(Globals.dataset_crm_name_keyField, Globals.dataset_type_string)
    ds.click_save_datasets()
    #ds.select_dataset(Globals.dataset_name_crm)
    ds.select_dataset("Edit_test")

Where should i put the % name?

Thanks, Riaz

asked 40 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 5 اسفند 1394 ساعت: 20:39

صفحه بندی