Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51066 > unrolled thread

How to tick checkboxes with the same name?

Started bymalayrev@gmail.com
First post2013-07-22 21:10 -0700
Last post2013-07-26 09:05 +0200
Articles 7 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  How to tick checkboxes with the same name? malayrev@gmail.com - 2013-07-22 21:10 -0700
    Re: How to tick checkboxes with the same name? Joel Goldstick <joel.goldstick@gmail.com> - 2013-07-23 01:05 -0400
      Re: How to tick checkboxes with the same name? malayrev@gmail.com - 2013-07-25 08:42 -0700
    Re: How to tick checkboxes with the same name? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-23 05:14 +0000
    Re: How to tick checkboxes with the same name? Peter Otten <__peter__@web.de> - 2013-07-23 09:25 +0200
      Re: How to tick checkboxes with the same name? malayrev@gmail.com - 2013-07-25 08:46 -0700
        Re: How to tick checkboxes with the same name? Peter Otten <__peter__@web.de> - 2013-07-26 09:05 +0200

#51066 — How to tick checkboxes with the same name?

Frommalayrev@gmail.com
Date2013-07-22 21:10 -0700
SubjectHow to tick checkboxes with the same name?
Message-ID<8fad5326-8518-4554-91bf-1c0b5c97d9bc@googlegroups.com>
I faced a problem: to implement appropriate search program I need to tick few checkboxes which turned out to have the same name (name="a", id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab library), this command leads to the error "checkboxgroup must be set to a sequence". I don't understand what the sequence actually is, so I'm stuck with how to tick the checkboxes. It would be really great if someone would help me with how to handle this question. The code is available here:
view-source:http://zakupki.gov.ru/pgz/public/action/contracts/search/ext/enter

[toc] | [next] | [standalone]


#51067

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-07-23 01:05 -0400
Message-ID<mailman.4992.1374555922.3114.python-list@python.org>
In reply to#51066
On Tue, Jul 23, 2013 at 12:10 AM,  <malayrev@gmail.com> wrote:
> I faced a problem: to implement appropriate search program I need to tick few checkboxes which turned out to have the same name (name="a", id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab library), this command leads to the error "checkboxgroup must be set to a sequence". I don't understand what the sequence actually is, so I'm stuck with how to tick the checkboxes. It would be really great if someone would help me with how to handle this question. The code is available here:
> view-source:http://zakupki.gov.ru/pgz/public/action/contracts/search/ext/enter
> --
> http://mail.python.org/mailman/listinfo/python-list

Have you tried a[0], a[1], etc. for the names?

--
Joel Goldstick
http://joelgoldstick.com

[toc] | [prev] | [next] | [standalone]


#51235

Frommalayrev@gmail.com
Date2013-07-25 08:42 -0700
Message-ID<f9d51105-ae0a-4720-99bb-b986f44f550a@googlegroups.com>
In reply to#51067
вторник, 23 июля 2013 г., 9:05:14 UTC+4 пользователь Joel Goldstick написал:
> On Tue, Jul 23, 2013 at 12:10 AM,  <malayrev@gmail.com> wrote:
> 
> > I faced a problem: to implement appropriate search program I need to tick few checkboxes which turned out to have the same name (name="a", id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab library), this command leads to the error "checkboxgroup must be set to a sequence". I don't understand what the sequence actually is, so I'm stuck with how to tick the checkboxes. It would be really great if someone would help me with how to handle this question. The code is available here:
> 
> > view-source:http://zakupki.gov.ru/pgz/public/action/contracts/search/ext/enter
> 
> > --
> 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> Have you tried a[0], a[1], etc. for the names?
> 
> 
> 
> --
> 
> Joel Goldstick
> 
> http://joelgoldstick.com

sure, I tried, doesn't work

[toc] | [prev] | [next] | [standalone]


#51068

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-07-23 05:14 +0000
Message-ID<51ee1135$0$29971$c3e8da3$5496439d@news.astraweb.com>
In reply to#51066
On Mon, 22 Jul 2013 21:10:18 -0700, malayrev wrote:

> I faced a problem: to implement appropriate search program I need to
> tick few checkboxes which turned out to have the same name (name="a",
> id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab
> library)

Instructions for solving your problem can be found here:

http://sscce.org/‎


Although it is written for Java, the same ideas will work for Python or 
any other programming language.

Have a read of that page, and if it isn't enough to solve your problem 
with "Grab" (whatever that is), feel free to come back.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#51073

FromPeter Otten <__peter__@web.de>
Date2013-07-23 09:25 +0200
Message-ID<mailman.4995.1374564292.3114.python-list@python.org>
In reply to#51066
malayrev@gmail.com wrote:

> I faced a problem: to implement appropriate search program I need to tick
> few checkboxes which turned out to have the same name (name="a",
> id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab
> library), 

For all but the most popular projects a url works wonders. I'm assuming 

http://grablib.org

> this command leads to the error "checkboxgroup must be set to a
> sequence". I don't understand what the sequence actually is, so I'm stuck
> with how to tick the checkboxes. 

If I were to guess:

set_input("a", [True, True, True, True])

but I don't see that form documented on page

http://docs.grablib.org/api/ext_form.html

If it doesn't work try

set_input_by_id(_"a1", True)
set_input_by_id(_"a2", True)

and so on.

[toc] | [prev] | [next] | [standalone]


#51236

Frommalayrev@gmail.com
Date2013-07-25 08:46 -0700
Message-ID<85c5f224-3ccc-421b-bb5d-d54c3defbd27@googlegroups.com>
In reply to#51073
вторник, 23 июля 2013 г., 11:25:00 UTC+4 пользователь Peter Otten написал:
> malayrev@gmail.com wrote:
> 
> 
> 
> > I faced a problem: to implement appropriate search program I need to tick
> 
> > few checkboxes which turned out to have the same name (name="a",
> 
> > id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab
> 
> > library), 
> 
> 
> 
> For all but the most popular projects a url works wonders. I'm assuming 
> 
> 
> 
> http://grablib.org
> 
> 
> 
> > this command leads to the error "checkboxgroup must be set to a
> 
> > sequence". I don't understand what the sequence actually is, so I'm stuck
> 
> > with how to tick the checkboxes. 
> 
> 
> 
> If I were to guess:
> 
> 
> 
> set_input("a", [True, True, True, True])
> 
> 
> 
> but I don't see that form documented on page
> 
> 
> 
> http://docs.grablib.org/api/ext_form.html
> 
> 
> 
> If it doesn't work try
> 
> 
> 
> set_input_by_id(_"a1", True)
> 
> set_input_by_id(_"a2", True)
> 
> 
> 
> and so on.

Well, I have read the documentation, I guess the problem lies in somewhat different field. As long as I understand it refers to Checkboxgroup classes. As checkboxes of interest belong to some common group with the common name "a", they do have values different from "True" or "False" (probably a sequence?) and I should guess somehow what are the real ones. How to do this?

[toc] | [prev] | [next] | [standalone]


#51288

FromPeter Otten <__peter__@web.de>
Date2013-07-26 09:05 +0200
Message-ID<mailman.5136.1374822335.3114.python-list@python.org>
In reply to#51236
malayrev@gmail.com wrote:

> вторник, 23 июля 2013 г., 11:25:00 UTC+4 пользователь Peter Otten написал:
>> malayrev@gmail.com wrote:

>> For all but the most popular projects a url works wonders. I'm assuming

>> http://grablib.org

> Well, I have read the documentation, I guess the problem lies in somewhat
> different field. As long as I understand it refers to Checkboxgroup
> classes. As checkboxes of interest belong to some common group with the
> common name "a", they do have values different from "True" or "False"
> (probably a sequence?) and I should guess somehow what are the real ones.
> How to do this?

I took a quick look into the source, and it seems that grab has no notion of 
multiple inputs with the same name. My suggested workaround 

>> set_input_by_id(_"a1", True)

doesn't work because (among other things) the id is immediately translated 
into the name. I fear you have to construct the request manually or choose 
another library -- maybe mechanize (Python 2 only)?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web