Python Programmer needs help

Alphabetize

RoonilWazlib
9 years ago

0

I’m kind of stuck. so far I have been researching it but I haven’t been able to find any way to put the text in the field and press submit w/ a program. Please help!!! Thanks.
PS I am using Python 3.x

11replies
8voices
309views
? [bolofecal]
9 years ago

0

I’m beginner in Python and I don’t know this yet. But if you use javascript you can use this:

To put value in field:
document.getElementById(‘’).value=‘’; (javascript)
$(“#”).val(‘’); (jQuery)

To submit
document.getElementById(‘’).submit(); (javascript)
$(“#”).submit(); (jQuery)

dloser
9 years ago | edited 9 years ago

0

If you want to have it do that in the browser, you’d have to search for “automation” (things like pywinauto and swapy should pop up). It’s a lot easier to do this with JavaScript directly in your browser.

To do it without the browser, you might want to look at the “requests” module. This does mean you either have to copy the cookies from your browser or have the program log into HT itself.

I would also advise you to read up on HTTP and HTML, so you understand what’s going on behind the scenes.

B.t.w.: if you mean this question in a general sense and not related to the Coding Level 1 challenge, you posted it in the wrong place.

? [bolofecal]
9 years ago

0

According to @dloser using javascript you can do this directly in your brownser. I think that js in this case is the faster way, because few characters can resolve it, if you want do this with python I think that your work will be bigger, but should be a good way to learn.

2 replies have been removed
Mr. Cyph3r [MrCyph3r]
9 years ago

0

As @dloser said it is possible to automate this process… actually there are tons of ways.

[quote=RoonilWazlib]put the text in the field and press submit w/ a program[/quote]

There is a nice module called Mechanize for Python, which is based on the WWW:Mechanize perl module if I remember correctly, that allows you to do exactly this.
It is very, very powerful, however it can be almost overkill for that challenge.

I also suggest to use “requests”, you can log in to the site with just 2 lines of code and then concentrate on the main part of the program.

If you don’t know how to parse the HTML code of the page you can take a look at BeautifulSoup, it is easy to use and also allows you to use lxml’s HTML parser.

dloser
9 years ago

0

[quote=MrCyph3r]If you don’t know how to parse the HTML code of the page you can take a look at BeautifulSoup, it is easy to use and also allows you to use lxml’s HTML parser.[/quote]
Or just use ‘split’ if you are a lazy bum like me. :)

Mr. Cyph3r [MrCyph3r]
9 years ago

0

Haha yeah, absolutely lol :D

RoonilWazlib
9 years ago

0

Hey guys Thanks so much for the replies, they’ve been very helpful.

? [bolofecal]
9 years ago

0

You are wellcome.

Mr. Cyph3r [MrCyph3r]
9 years ago

0

[quote=RoonilWazlib]Hey guys Thanks so much for the replies, they’ve been very helpful.[/quote]

That’s a good thing, glad to be helpful :)

Maestro [maestroi]
9 years ago | edited 9 years ago

0

sorry was posting my solution to much

TheAbecedarian
9 years ago | edited 9 years ago

0

As of now, Mechanize is only for older Python versions, afaik.
You should try the Selenium module for python. I got it to work like that. Also: IMO some of its usage resembles the corresponding javascript methods a lot.

You must be logged in to reply to this discussion. Login
1 of 12

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss