TypeError:无法读取属性' click'的null [英] TypeError: Cannot read property 'click' of null

查看:55
本文介绍了TypeError:无法读取属性' click'的null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Twitter上使用这些代码大量关注/取消关注/收藏/不喜欢这些代码;

I have been mass following / unfollowing / favoriting / unfavoriting on twitter with these codes ;

$('button.follow-button').click();
$('button.ProfileTweet-actionButtonUndo').click();
$('a.favorite').click();

我在网上找到了一些无法使用的代码,并试图对其进行修复,因此它们现在几乎可以正常工作了.唯一的事情是转到google chrome上的页面,按f12键,打开控制台并运行命令.

I found some not-working codes online and tried to fix, so they are nearly working now. The only thing is to go to the page on google chrome, press f12 , open console and run the command.

所以现在,我想在Vine中使用相同的系统.谷歌浏览器有一个扩展可以使用vine( https://client.vineclient.com/)和我正在尝试使用它,因为原始网页(vine.co)甚至都没有用.

So now, I wanted to use the same system in Vine. There"s an extension for google chrome to use vine ( https://client.vineclient.com/ ) and I am trying to use it because original webpage ( vine.co ) is not even useful.

twitter与this的唯一区别是,在藤本客户端的^ followers ^部分中,页面上弹出了一个窗口.而且我不知道它是否检测到按钮.

The only difference between twitter and this, is that, in vine client for ^followers^ section, an pop-up comes in the page. And I don!t know if it detects the buttons.

因此,我尝试从原始页面单击的按钮的代码((我使用开发人员工具/元素使用了它)

So , the code of the button I am trying to click from original page , ( I took it using developer tools / elements )

<div class="user">
<img alt="Tuğçe Nur TEKİN" class="avatar" src="http://v.cdn.vine.co/r/avatars/3C2E4F40F11066473630650847232_pic-r-1397241239141e51579937f.jpg.jpg?versionId=ttIz4CExCjW_4TEnxYbnehPPpXRyzMco">
<div class="wrapper">
<a class="username" 
href="https://client.vineclient.com/explore/users/1066473613911363584">
Tuğçe Nur TEKİN
</a>
</div>
<a class="button follow" data-id="1066473613911363584">
<i class="icon">
</i>
</a>
</div>

要单击的东西在这里:

当我手动单击时,它变为:

When I manually click, it changes into this :

<a class="button unfollow" data-id="1066473613911363584"><i class="icon"></i></a>

还有我用来尝试单击的命令

And the command I use to try to click

$(".a.follow").click();

我得到的错误,

TypeError: Cannot read property 'click' of null

我该如何解决?顺便说一下,在这些代码中,我实际上找不到任何^ button ^代码.谢谢!

How can I fix that? By the way, in these codes, I couldn"t find actually any ^button^ codes.. Thanks!

更新

  1. http://prntscr.com/3pmo2i
  2. http://prntscr.com/3pmoyk
  3. http://prntscr.com/3pmpym

推荐答案

当我同时使用开发人员工具从其他地方(例如Selenium)在网页上运行javascript时,遇到了此问题.尝试关闭开发人员工具并运行脚本.

I had encountered this problem, when I run javascript on the webpage from elsewhere (eg. Selenium) while simultaneously using Developer Tools. Try closing Developer Tools and run the script.

这篇关于TypeError:无法读取属性&amp;#39; click&amp;#39;的null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆