我正在尝试用Selenium
和PHP
对YouTube
评论进行投票,我正在使用Facebook Webdriver
。
我的问题是点击不做任何事情,它适用于任何其他网站,但不适用于YouTube
投票。
我正在使用带有geckodriver
的硒 3.4.0 和firefox
55.0.3Windows 10
我的代码是这样的:
Login
Go to the comment url
Scroll down and wait comments to show up
$element = $driver->findElement(WebDriverBy::xpath("(//a[contains(@class, 'comment-author-text') and contains(text(),'channelname')]/following::button[contains(@class, 'i-a-v-sprite-like')])[1]"));
$element->click();
我试过$driver->getMouse()
但它不起作用。
经过一番搜索,我发现它不能与我的设置一起使用,我需要降级硒,但我不想这样做。
我发现我链接的评论将我直接带到回复框,所以我不得不先关闭它(使用取消按钮),然后我能够喜欢评论