Opening Webpage using Python
I am new to Python coding and i am trying to open a web page using python. I used web browser.open to open the web page.开发者_如何学JAVA After i opened the web page i want to click a tab called "Submit" on the web page when the timer on the page reaches zero. If i get a error then it should return to the original page without any user interaction. Is this possible?
Thanks
Instead of using that particular module, maybe you want to use Selenium RC, which has python bindings.
This will depend on if you need to use a "real" browser application to do this. Can you explain what you are trying to do in a bit more detail?
Anyway...
If you need a "real" browser to launch and make these requests, then the Selenium RC package is what you need.
On the other hand, if it's OK that Python does all the page loading internally, then the popular Mechanize module should do the trick.
To Explain:
If you are depending on a complex JavaScript powered page, then you must use Selenium. If it's just HTML stuff, then Mechanize can emulate it all inside python.
Hope this helps. If so, mark this answered and let me know. :-)
This is what mechanize is for: http://wwwsearch.sourceforge.net/mechanize/
精彩评论