I am struggling in converting the follow Xpath to CSS: "//form[@id=\'giftcard-form\']/div[3]/div/button". I know I could use the Xpath for my selenium JS but it doesn't work in my case for some odd reason. I was successful in converting an easier one and using its in the script but I can't get this one right. Anyone can help?
2 Answers
One should learn how to write css selectors, but a for a quick fix, try: cssify
For example, I put in your xpath and it spit out: form#giftcard-form > div:nth-of-type(3) > div > button
Btw, you had an error in your xpath, it should be this: //form[@id='giftcard-form']/div[3]/div/button
#giftcard-form div:nth-child(3) buttonform#giftcard-form > div:nth-of-type(3) > div > button