2

I have tried to handle the dynamic xpath and css selector by many ways, but not getting the correct solution. Please help me out regarding this issue.

xpath is //*[@id="product_properties_attributes_15434094021_value"]

Here the number "15434094021" is changing every time at the time of opening the page. I have also tried with css selector by it is not solved. I have tried with "Starts with" & "Contains", but not solved. Before the same type of questions are posted and answered also. But this question is not solved and that is why I have posted this question.

getting this error for starts-with

selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //*div[starts-with(@id,'product_properties_attributes_')] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*div[starts-with(@id,'product_properties_attributes_')]' is not a valid XPath expression.

And this below-mentioned error for using "contains" -

selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //*div[contains(@id,'product_properties_attributes_') and contains(@id,'_value')] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*div[contains(@id,'product_properties_attributes_') and contains(@id,'_value')]' is not a valid XPath expression.

16
  • Can you share the url? Commented Dec 3, 2018 at 7:29
  • Could you please tell me which URL I need to share? Commented Dec 3, 2018 at 7:45
  • The url where you are trying to work with these elements of dynamic xpath Commented Dec 3, 2018 at 7:49
  • As uid and pw required to open the link - it cannot be shared. I have given the xpath. Commented Dec 3, 2018 at 10:16
  • @kamal - probably this can help you to find out... <input id="product_properties_attributes_15438407881_value" name="product[properties_attributes][15438407881][value]" required="required" size="30" type="text"> Commented Dec 3, 2018 at 12:42

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.