I'm new to autotests and I'm just starting to master Codeception. I am writing an autotest and at the end of the autotest I need to delete the . But when creating a new theme, a delete button with a dynamic ID is generated for it. How do I access this button for each new topic? Here is part of the code! The button I need is called "Delete"
<span data-theme_id="12445247" >
<span ></span>Delete</span>
CodePudding user response:
As you can see yourself, the data-theme_id
attribute of this element is dynamically generated for each browsing session. What is seems to be a fixed values are icon-delete-summary
class name of first span
element and the Delete
text of the second span
.
So, I would guess the following XPath should work here:
"//span[text()='Delete']"
Or in case the former locator is not unique maybe this:
"//span[contains(@class,'js-deleteTheme')]//span[contains(.,'Delete')]"