我将值提交给Google的python代码:
from twill.commands import *
go('www.google.com')
showforms()
formclear('1')
fv("1", "q", "python")
showforms()
submit('btnG')当它运行时,它显示以下错误:
***MissingSchema: Invalid URL u'/search': No schema supplied. Perhaps you meant http:///search?*** 发布于 2015-03-11 23:04:28
关键字是formaction('1', 'www.google.com/search'),所以在您的例子中:
from twill.commands import *
go('www.google.com')
showforms()
formclear('1')
fv("1", "q", "python")
formaction('1', 'www.google.com/search')
showforms()
submit('btnG')至于让代码真正进行搜索,我不太确定。
您可以使用"http://www.google.com/?q=" + searchFor"通过url进行谷歌搜索
https://stackoverflow.com/questions/27614603
复制相似问题