How to tick checkboxes with the same name?

M

malayrev

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 withhow to handle this question. The code is available here:
view-source:http://zakupki.gov.ru/pgz/public/action/contracts/search/ext/enter
 
J

Joel Goldstick

I faced a problem: to implement appropriate search program I need to tickfew 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

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

Steven D'Aprano

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.
 
P

Peter Otten

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.
 
M

malayrev

вторник, 23 Ð¸ÑŽÐ»Ñ 2013 г., 9:05:14 UTC+4 пользователь Joel Goldstick напиÑал:
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 howto tick the checkboxes. It would be really great if someone would help me with how to handle this question. The code is available here:


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
 
M

malayrev

вторник, 23 Ð¸ÑŽÐ»Ñ 2013 г., 11:25:00 UTC+4 пользователь Peter Otten напиÑал:
(e-mail address removed) 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?
 
P

Peter Otten

вторник, 23 Ð¸ÑŽÐ»Ñ 2013 г., 11:25:00 UTC+4 пользователь Peter Otten напиÑал:
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

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)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top