Python 3.5 with Selenium Webdriver, 485 427 469 461 449 414 403 bytes:
from selenium.webdriver import*;import time;D=Chrome();I=lambda k:D.find_element_by_name(k);C='comment';D.get('http://www.codegolf.stackexchange.com/users/login');I('email').send_keys(U);Z=I('password');Z.send_keys(P);Z.submit();D.get('http://www.codegolf.stackexchange.com/questions/84546');D.find_element_by_link_text('add a '+C).click();E=I(C);E.send_keys('1234567890123456');time.sleep(1);E.submit()
A full program utilizing a simple Python selenium web driver solution. Works in Chrome, although it needs ChromeDriver installed to work. Works by renaming U
and P
to the user's Stack Exchange email and password, respectively. However, if there are any issues getting ChromeDriver installed, here is a FireFox solution that gets executed in the exact same manner as the above solution and does not need any drivers, although it is currently 1 byte longer at 414 404 bytes:
from selenium.webdriver import*;import time;D=Firefox();I=lambda k:D.find_element_by_name(k);C='comment';D.get('http://www.codegolf.stackexchange.com/users/login');I('email').send_keys(U);Z=I('password');Z.send_keys(P);Z.submit();D.get('http://www.codegolf.stackexchange.com/questions/84546');D.find_element_by_link_text('add a '+C).click();E=I(C);E.send_keys('1234567890123456');time.sleep(1);E.submit()
Also, if a function is wanted, here is a solution using an anonymous lambda function, currently standing at 513 455 497 489 477 449 431 bytes and using Chrome as the browser.
lambda U,P:exec("from selenium.webdriver import*;import time;D=Chrome();I=lambda k:D.find_element_by_name(k);C='comment';D.get('http://www.codegolf.stackexchange.com/users/login');I('email').send_keys(U);Z=I('password');Z.send_keys(P);Z.submit();D.get('http://www.codegolf.stackexchange.com/questions/84546');D.find_element_by_link_text('add a '+C).click();E=I(C);E.send_keys('1234567890123456');time.sleep(1);E.submit()",locals())
However, if there are, again, any issues regarding ChromeDriver, here is the same type of solution but this time using Firefox, currently standing at 442 432 bytes:
lambda U,P:exec("from selenium.webdriver import*;import time;D=Firefox();I=lambda k:D.find_element_by_name(k);C='comment';D.get('http://www.codegolf.stackexchange.com/users/login');I('email').send_keys(U);Z=I('password');Z.send_keys(P);Z.submit();D.get('http://www.codegolf.stackexchange.com/questions/84546');D.find_element_by_link_text('add a '+C).click();E=I(C);E.send_keys('1234567890123456');time.sleep(1);E.submit()",locals())
You call these lambda functions by simply renaming the function as anything valid and then calling with your email and password like a normal function. For instance, if the function were named H
, you would call it like H(Email, Password)
.
Welcome to PPCG! Interesting first post! Seems a bit hard in most languages though, but I think it's good anyway. – Rɪᴋᴇʀ – 2016-07-05T20:03:19.707
27Please post a screenshot of your inbox at the end of this challenge... – Martin Ender – 2016-07-05T20:03:30.843
You should maybe make a post on Meta where people can test their submissions, but this is completely optional. – Loovjo – 2016-07-05T20:05:11.100
@Loovjo You can always delete your comment – Bálint – 2016-07-05T20:06:05.000
@Bálint That may be a bit tedious to do every time you test the program. – Loovjo – 2016-07-05T20:07:11.723
@Loovjo I can only post once every 40 minutes :( but I made the page. – Meinkraft – 2016-07-05T20:08:54.250
Oh, by the way, if you decide to post on meta, you should maybe use another account, since you'll be getting a lot of unnecessary notifications otherwise. – Loovjo – 2016-07-05T20:19:15.557
I don't think creating a meta post to test answers is a good idea. – Dennis – 2016-07-05T22:42:36.390
1To the people testing their code: please delete your comment(s) after you submit them, to keep the comments on this challenge from getting unnecessarily long and spammy, and to make the mods' jobs easier. – Mego – 2016-07-05T23:15:45.967
Also, retrieving the
access_token
from a browser session is difficult (if not impossible) for some languages. – LegionMammal978 – 2016-07-06T00:10:20.0601Does nobody else think this is underspecified? Like, how the hell do I do that? Aren't questions meant to be self-contained? Where's the link to the API docs? – cat – 2016-07-06T00:22:46.987
4@cat While I agree that the specifications are rather sparse, I think it's because there just isn't a whole that needs to be said. Also note that using the Stack Exchange API isn't required by the question, so including API docs in the question would be rather superfluous. – Alex A. – 2016-07-06T01:03:04.650
This works on specific languages only. Many languages do not support Internet. – None – 2016-07-06T05:35:34.600
3Voting to close as unclear because looking at the existing answers and comments it seems to me that this needs a) to explicitly white-list the permitted inputs (on a plain reading answers may take no input, but some of them seem to be taking auth details and bypassing the implied requirement to use username and password to log in); b) to clarify what is meant by "You may leave your usernames and passwords as U and P, respectively" (which I would interpret as telling us to hardcode "U" and "P", but which others have clearly interpreted differently). – Peter Taylor – 2016-07-06T08:21:28.053
@PeterTaylor Thanks for the suggestions. I edited the question just now. Are there any other suggestions you would like me to add? – Meinkraft – 2016-07-06T17:00:12.033
Can you clarify what you mean by URL shorteners? Clearly bit.ly and goo.gl would not be disallowed, but what about http://ppcg.lol, which is a custom domain owned by Quill that redirects to this site?
– Mego – 2016-07-08T03:17:23.047@Mego if you want to access this question, you have to use codegolf.stackexchange.com/questions/84546 and not ppcg.lol/q/84546 (I commented to Sirens to change his answer because he used ppcg) – Meinkraft – 2016-07-08T18:58:53.977
11234567890123456 (this is not sent by script :P) – Matthew Roh – 2017-03-18T07:46:01.360
1234567890123456 – None – 2019-08-24T07:49:14.193
1234567890123456 – None – 2019-08-24T07:49:36.490
123456789023456 – None – 2019-08-24T07:49:43.020
123456789023456 – None – 2019-08-24T07:49:44.380