文档/使用硒的示例Python浏览网站 [英] Documentation/Examples of using Selenium & Python to navigate a website
问题描述
我今天才刚开始使用python和Selenium,所以在最深处稍作介绍.
I've just started using python and Selenium today so in at the deep end a little.
到目前为止,我已经使用该文档获取了一个Python脚本来加载google,搜索某些内容,然后对结果进行屏幕截图.
So far I've used the documentation to get a python script to load google, search for something and then take a screenshot of the results.
我想要的是能够加载一个网站,导航到某些元素并拍摄各个页面的屏幕截图.但是,我在努力寻找导航文档.
What I want is to be able to load a website, navigate to certain elements and take screenshots of various pages. I'm struggling to find documentation for navigation however.
有人可以指出我对find_element的示例/解释(或提供答案)以及您实际可以找到的内容,以及一旦找到后如何打开元素的方法.我想要的许多文档仍在开发中:(
Could someone point me towards (or post an answer with) examples/explanation of find_element and what you can actually find, and also how to open elements once found. The documentation for lots of what I wanted is still under development :(
我一直在浏览googlecode上的WebDriver文档,了解我认为我需要的那种方法,但似乎它们都是私有API的一部分,那么有什么替代方法? 我一直在所有东西上看到这一点;
I've been looking through the WebDriver docs on googlecode at the kind of methods I thought I needed but it seems they are all part of the private API so what alternatives are there? I keep seeing this on everything;
此方法是私有API的一部分.您应尽可能避免使用此方法,因为将来可能会删除或更改它.
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
在此处找到了一个很好的Action_Chains示例; https://stackoverflow.com/a/8261754/1199464
Found a great example of Action_Chains on here; https://stackoverflow.com/a/8261754/1199464
推荐答案
虽然硒文档的顺序不是特别好,但是我觉得一切都在这里.
While the selenium documentation is not in a particularly good order, I feel like everything is there.
您可以例如从此处开始: http://code.google.com/p/selenium/wiki/FurtherResources xpath似乎是查找元素的不错选择.
You could e.g. start here: http://code.google.com/p/selenium/wiki/FurtherResources xpath seems a good choice for finding elements.
此页面似乎还包含您需要的内容: http://seleniumhq. org/docs/03_webdriver.html#commands-and-operation
Also this page seems to contain what you need: http://seleniumhq.org/docs/03_webdriver.html#commands-and-operation
我发现了它,它应该包含您需要的内容: http://selenium.googlecode.com/svn/trunk/docs/api/py/api.html (对不起p0deje,我没有看到您已经发布了最后一个链接...)
edit: I found this and it should contain what you need: http://selenium.googlecode.com/svn/trunk/docs/api/py/api.html (sry p0deje, I didnt see that you already posted that last link...)
这篇关于文档/使用硒的示例Python浏览网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!