Mark,<br><br>Your first code snippet works fine for me, on both twill 0.9 and trunk.  Is it b.submit() that is specifically causing the error?<br><br>I&#39;m interested in the last bit of that traceback, though:<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
  File &quot;/opt/ams/mdevine/lib/python2.<br>4/urllib2.py&quot;, line 1053, in unknown_open<br>
    raise URLError(&#39;unknown url type: %s&#39; % type) <br>urllib2.URLError: &lt;urlopen error unknown url type: &#39;http&gt;</blockquote><div><br>It looks like a url is getting parsed incorrectly somewhere, or perhaps double quoted (as in two sets of quotes). I am unable to reproduce, so I can&#39;t really tell any more.<br>
<br>As for the yahoo thing, I don&#39;t really see what the problem is.  Why would the inbox show up as a form?  Do either of these sites even work without javascript?<br></div><div> <br>Nat<br></div><br><br><div class="gmail_quote">
On Mon, Jun 29, 2009 at 9:00 AM, Mark Devine <span dir="ltr">&lt;<a href="mailto:mfmdevine@gmail.com">mfmdevine@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>
I need help automating both gmail and yahoo mail using twill. I wonder<br>
if someone could point me in the right direction. I used the following<br>
code to access gmail but I got a<br>
         urllib2.URLError: &lt;urlopen error unknown url type: &#39;http&gt;<br>
error when I ran it. I have included the Traceback<br>
<br>
import twill, string, os<br>
b=twill.commands.get_browser()<br>
b.set_agent_string(&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1;<br>
en-GB;rv:1.8.1.14) Gecko/20080404 Firefox/<a href="http://2.0.0.14" target="_blank">2.0.0.14</a>&quot;)<br>
b.clear_cookies()<br>
b.go(&#39;<a href="http://www.gmail.com" target="_blank">http://www.gmail.com</a>&#39;)<br>
f=b.get_form(&quot;1&quot;)<br>
b.showforms()<br>
f[&#39;Email&#39;]= email<br>
f[&#39;Passwd&#39;] =password<br>
b.clicked(f, f)<br>
b.submit()<br>
<br>
When I run the code I get:<br>
<br>
Traceback (most recent call last):<br>
  File &quot;&lt;stdin&gt;&quot;, line 1, in ?<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/browser.py&quot;, line<br>
115, in go<br>
    self._journey(&#39;open&#39;, u)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/browser.py&quot;, line<br>
540, in _journey<br>
    r = func(*args, **kwargs)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 156, in open<br>
    return self._mech_open(url, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 182, in _mech_open<br>
    response = UserAgentBase.open(self, request, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 191, in open<br>
    response = meth(req, response)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py&quot;,<br>
line 573, in http_response<br>
    response = self.parent.error(<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 208, in error<br>
    result = apply(self._call_chain, args)<br>
  File &quot;/opt/ams/mdevine/lib/python2.4/urllib2.py&quot;, line 337, in _call_chain<br>
    result = func(*args)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py&quot;,<br>
line 129, in http_error_302<br>
    return self.parent.open(new)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 156, in open<br>
    return self._mech_open(url, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 182, in _mech_open<br>
    response = UserAgentBase.open(self, request, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 191, in open<br>
    response = meth(req, response)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py&quot;,<br>
line 573, in http_response<br>
    response = self.parent.error(<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 208, in error<br>
    result = apply(self._call_chain, args)<br>
  File &quot;/opt/ams/mdevine/lib/python2.4/urllib2.py&quot;, line 337, in _call_chain<br>
    result = func(*args)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py&quot;,<br>
line 129, in http_error_302<br>
    return self.parent.open(new)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 156, in open<br>
    return self._mech_open(url, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 182, in _mech_open<br>
    response = UserAgentBase.open(self, request, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 191, in open<br>
    response = meth(req, response)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/utils.py&quot;, line<br>
455, in http_response<br>
    &quot;refresh&quot;, msg, hdrs)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 208, in error<br>
    result = apply(self._call_chain, args)<br>
  File &quot;/opt/ams/mdevine/lib/python2.4/urllib2.py&quot;, line 337, in _call_chain<br>
    result = func(*args)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py&quot;,<br>
line 129, in http_error_302<br>
    return self.parent.open(new)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 156, in open<br>
    return self._mech_open(url, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py&quot;,<br>
line 182, in _mech_open<br>
    response = UserAgentBase.open(self, request, data)<br>
  File &quot;/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py&quot;,<br>
line 180, in open<br>
    response = urlopen(self, req, data)<br>
  File &quot;/opt/ams/mdevine/lib/python2.4/urllib2.py&quot;, line 381, in _open<br>
    &#39;unknown_open&#39;, req)<br>
  File &quot;/opt/ams/mdevine/lib/python2.4/urllib2.py&quot;, line 337, in _call_chain<br>
    result = func(*args)<br>
  File &quot;/opt/ams/mdevine/lib/python2.4/urllib2.py&quot;, line 1053, in unknown_open<br>
    raise URLError(&#39;unknown url type: %s&#39; % type)<br>
urllib2.URLError: &lt;urlopen error unknown url type: &#39;http&gt;<br>
<br>
I also had a problem with yahoo mail when I logged in I found that<br>
there was just one form and it had not got the inbox in it:<br>
<br>
&gt;&gt;&gt; import twill, string, os<br>
&gt;&gt;&gt; b=twill.commands.get_browser()<br>
&gt;&gt;&gt; b.set_agent_string(&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;rv:1.8.1.14) Gecko/20080404 Firefox/<a href="http://2.0.0.14" target="_blank">2.0.0.14</a>&quot;)<br>
&gt;&gt;&gt; b.clear_cookies()<br>
&gt;&gt;&gt; b.go(&quot;<a href="http://mail.yahoo.com" target="_blank">http://mail.yahoo.com</a>&quot;)<br>
Redirected to &lt;Request for<br>
<a href="https://login.yahoo.com/config/login_verify2?&amp;.src=ym" target="_blank">https://login.yahoo.com/config/login_verify2?&amp;.src=ym</a>&gt;<br>
==&gt; at <a href="https://login.yahoo.com/config/login_verify2?&amp;.src=ym" target="_blank">https://login.yahoo.com/config/login_verify2?&amp;.src=ym</a> in<br>
0.37890791893  secs<br>
&gt;&gt;&gt; f=b.get_form(&quot;1&quot;)<br>
&gt;&gt;&gt; b.showforms()<br>
<br>
Form name=login_form (#1)<br>
## ## __Name____________________________ __Type___<br>
__ID____________________ __Value__________________<br>
1     .tries                             hidden    (None)<br>
               1<br>
2     .src                               hidden    (None)<br>
               ym<br>
3     .md5                               hidden    (None)<br>
4     .hash                              hidden    (None)<br>
5     .js                                hidden    (None)<br>
6     .last                              hidden    (None)<br>
7     promo                              hidden    (None)<br>
8     .intl                              hidden    (None)<br>
               us<br>
9     .bypass                            hidden    (None)<br>
10    .partner                           hidden    (None)<br>
11    .u                                 hidden    (None)<br>
               81cps6p54h7fv<br>
12    .v                                 hidden    (None)<br>
               0<br>
13    .challenge                         hidden    (None)<br>
               2xPl5mhaAcuDjrKcEK7zP_fLN8.E<br>
14    .yplus                             hidden    (None)<br>
15    .emailCode                         hidden    (None)<br>
16    pkg                                hidden    (None)<br>
17    stepid                             hidden    (None)<br>
18    .ev                                hidden    (None)<br>
19    hasMsgr                            hidden    (None)<br>
               0<br>
20    .chkP                              hidden    (None)<br>
               Y<br>
21    .done                              hidden    (None)<br>
               <a href="http://mail.yahoo.com" target="_blank">http://mail.yahoo.com</a><br>
22    .pd                                hidden    (None)<br>
               ym_ver=0&amp;c=&amp;ivt=&amp;sg=<br>
23    login                              text      username<br>
24    passwd                             password  passwd<br>
25    .persistent                        checkbox  persistent<br>
               [] of [&#39;y&#39;]<br>
26 1  .save                              submit    (None)<br>
               Sign In<br>
<br>
&gt;&gt;&gt; f[&#39;login&#39;]= email<br>
&gt;&gt;&gt; f[&#39;passwd&#39;] =password<br>
&gt;&gt;&gt; b.clicked(f, f)<br>
&gt;&gt;&gt; b.submit()<br>
Note: submit is using submit button: name=&quot;.save&quot;, value=&quot;Sign In&quot;<br>
Following HTTP-EQUIV=REFRESH to<br>
<a href="http://ie.mg41.mail.yahoo.com/dc/launch?.gx=0&amp;.rand=ats9inotdjll8" target="_blank">http://ie.mg41.mail.yahoo.com/dc/launch?.gx=0&amp;.rand=ats9inotdjll8</a><br>
Redirected to &lt;Request for<br>
<a href="http://ie.mg41.mail.yahoo.com/dc/launch?.gx=0&amp;.rand=ats9inotdjll8" target="_blank">http://ie.mg41.mail.yahoo.com/dc/launch?.gx=0&amp;.rand=ats9inotdjll8</a>&gt;<br>
&gt;&gt;&gt; b.showforms()<br>
<br>
Form #1<br>
## ## __Name____________________________ __Type___<br>
__ID____________________ __Value__________________<br>
1     webSrchInput                       text      webSrchInput<br>
2     ei                                 hidden    ei<br>
               UTF-8<br>
3     fr                                 hidden    fr_code<br>
               ush-mailc<br>
4     p                                  hidden    p<br>
5  1  searchbutton                       submit    searchbutton<br>
               Search<br>
<br>
&gt;&gt;&gt;<br>
<br>
Any help would be appreciated as I need to create webmail generators for work.<br>
<br>
Thanks<br>
<br>
M<br>
<br>
_______________________________________________<br>
twill mailing list<br>
<a href="mailto:twill@lists.idyll.org">twill@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/twill" target="_blank">http://lists.idyll.org/listinfo/twill</a><br>
</blockquote></div><br>