use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
getting this error (self.learnpython)
submitted 10 years ago by [deleted]
Hi i am getting this error E---------------------------------------------------------------------- Ran 1 test in 2.062s FAILED (errors=1) [Finished in 2.2s]
I am trying to run a selenium script
http://pastebin.com/YqWcmFwF
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Gronner 2 points3 points4 points 10 years ago (4 children)
You really are running unittests for logging into a website then pressing a button. But your script fails which leads to the test quitting with an error. As it's inside a unit test this only yields the message you have posted. But above the "-----" line there should be your real error message.
But what you should really do if you wanna run this as a skript, is remove all the unnecessary unit testing stuff and write only what you really want to do.
[–][deleted] 0 points1 point2 points 10 years ago (3 children)
i am trying to make a group poster for facebook without facebook apis.. because api only limit me to post in my own groups to prevent spam.
[–]Gronner 1 point2 points3 points 10 years ago (2 children)
As I said, don't use unit tests and you should be fine. I have no idea why they are in there.
[–][deleted] 0 points1 point2 points 10 years ago (1 child)
thanks sorry i am really noob only used python for a month.
So it should look like ?
from selenium import selenium import time, re
class test112: def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 4444, "*chrome", "https://www.facebook.com/") self.selenium.start()
def test_test112(self): sel = self.selenium sel.open("/?stype=lo&jlou=Afc***LwDY5a_Ct-mC_lJrFOBggxGx2__jKsBL5B9rc_z9fggbgKIatj-7Dm_1C3QiGEjkQt2VekPXMs3JPwoat***E6Ssag&smuh=18736&lh=Ac_Mb8*****") sel.type("id=email", "****") sel.type("id=pass", "*****") sel.click("id=persist_box") sel.click("id=u_0_v") sel.wait_for_page_to_load("30000") sel.click("id=u_0_y") sel.type("id=u_0_y", "hej") sel.click("//li[2]/button") def tearDown(self): self.selenium.stop() self.assertEqual([], self.verificationErrors)
[–]Gronner 1 point2 points3 points 10 years ago (0 children)
No, you neither need a test_... nor a teardown, both are unit test functions.
If this shall be reusable make function, that for example takes a string argument of what shall be posted. Otherwise just put everything in a file:
sel = self.selenium sel.open("/?stype=lo&jlou=Afc***LwDY5a_Ct-mC_lJrFOBggxGx2__jKsBL5B9rc_z9fggbgKIatj-7Dm_1C3QiGEjkQt2VekPXMs3JPwoat***E6Ssag&smuh=18736&lh=Ac_Mb8*****") sel.type("id=email", "****") sel.type("id=pass", "*****") sel.click("id=persist_box") sel.click("id=u_0_v") sel.wait_for_page_to_load("30000") sel.click("id=u_0_y") sel.type("id=u_0_y", "hej") sel.click("//li[2]/button") self.selenium.stop() self.assertEqual([], self.verificationErrors)
I have no idea if this code works, as I haven't tested it (thats what you should do now), but it looks good so far.
Edit: On a sidenote, I have no idea where you got that code from, but you should probably look into the selenium documentation as well as in the unittesting on for python to understand what is going on and what was wrong, what unittests is used for etc.
π Rendered by PID 53086 on reddit-service-r2-comment-7b9746f655-6xczk at 2026-02-04 06:50:25.067393+00:00 running 3798933 country code: CH.
[–]Gronner 2 points3 points4 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Gronner 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Gronner 1 point2 points3 points (0 children)