I have xpath
page.search("//table[@class='campaign']//table")
which returns two tables.
I need to choose only first table. This line doesn’t work:
page.search("//table[@class='campaign']//table[1]")
How to choose only first table?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This bugged me, too. I still don’t exactly know why your solution does not work. However, this should:
EDIT: As the docs say,
Thanks to your question, I finally understood why this works this way :). So, depending on your structure and needs, this should work.