简体   繁体   English

编写脚本以单击网页上的按钮?

[英]Write a script to click a button on a webpage?

There is a Google Chrome extension called "Pandora to Spotify Playlist Converter" which grabs your Pandora likes, extracts the name and artist, and finds the Spotify links for them. Google Chrome浏览器扩展名为“ Pandora到Spotify播放列表转换器”,它可以捕获您的Pandora所喜欢的内容,提取名称和演出者,并找到它们的Spotify链接。

The only problem is that Pandora only shows five of your liked songs at a single time. 唯一的问题是Pandora一次只显示您喜欢的五首歌曲。 To display more, you have to click the button "Show More" which displays only five more songs. 要显示更多,您必须单击“显示更多”按钮,该按钮仅显示另外五首歌曲。 The extension only works when the songs titles are loaded and displayed onto the webpage. 该扩展程序仅在歌曲标题加载并显示在网页上时起作用。 So herein lies my problem. 因此,这就是我的问题。

I have 235 likes, which means that I'd have to click the "Show More" button 47 times, which means that if I click the button, scroll down, and click it again (which takes about two seconds), it'd take me a little over a minute and a half of tedious work. 我有235个点赞,这意味着我必须单击“显示更多”按钮47次,这意味着如果我单击该按钮,向下滚动并再次单击(大约需要两秒钟),花了我一分半钟的乏味工作。 Why not write a script that can do this in seconds? 为什么不编写可以在几秒钟内完成此操作的脚本?

I've looked at other posts and see than many answers include the use of "Selenium," an IDE integrated into Firefox. 我看过其他文章,看到很多答案都包括使用“ Selenium”(一种集成到Firefox中的IDE)。 The problem there is that the Google Chrome extension only exists for Chrome; 那里的问题是Google Chrome扩展程序仅适用于Chrome; there is no Firefox add-on that does the same thing. 没有可以执行相同操作的Firefox插件。 Does anyone know of a way I can go about this, and possibly using Javascript or Python to accomplish it? 有谁知道我可以解决这个问题的方法,可能使用Java或Python来完成它吗?

好吧,我认为您可以使用机械化模块来完成此操作,这是一个教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM