Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
您正在使用绝对 xpath,这不是首选,因为网站的微小更改会使您的代码无效。始终尝试使用相对 xpath。
不管怎样,试试这个代码,它会起作用的。
driver.find_element_by_xpath("//main[@role='main']//button/div[contains(string(), 'Follow')]").click()
根据您在 Instagram 上看到的语言内容更改“关注”文本。对于德语,代码应该是
driver.find_element_by_xpath("//main[@role='main']//button/div[contains(string(), 'Folgen')]").click()
You are using absolute xpath which is not preferred because a minor change in website renders your code ineffective. Always try to use relative xpath.
Anyway, try this code, it will work.
Change the text "Follow" as per what you see in your language on instagram. For german language, the code should be
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
您正在使用绝对 xpath,这不是首选,因为网站的微小更改会使您的代码无效。始终尝试使用相对 xpath。
不管怎样,试试这个代码,它会起作用的。
根据您在 Instagram 上看到的语言内容更改“关注”文本。对于德语,代码应该是
You are using absolute xpath which is not preferred because a minor change in website renders your code ineffective. Always try to use relative xpath.
Anyway, try this code, it will work.
Change the text "Follow" as per what you see in your language on instagram. For german language, the code should be