How to login a forum using Selenium with Python

0 votes

I’m trying to use Selenium and PhantomJS for headless browsing to login a forum.Below is the code I used using Firefox and then change it to PhantomJS

driver = webdriver.PhantomJS()

base_url = "http://6atxfootball.vbulletin.net/"

verificationErrors = []

accept_next_alert = True

driver.get(base_url)

driver.find_element_by_id("lnkLoginSignupMenu").click()

driver.find_element_by_id("idLoginUserName").clear()

driver.find_element_by_id("idLoginUserName").send_keys("USERNAME_HERE")

driver.find_element_by_id("idLoginPassword").clear()

driver.find_element_by_id("idLoginPassword").send_keys("PASSWORD_HERE ")

driver.find_element_by_id("idLoginBtn").click()

It shows an error is “NoSuchElementException:”.

driver.find_element_by_id("idLoginUserName").clear()

does this mean there’s no such an element when it’s opened by PhantomJS()?

I also tried to save the content also by PhantomJS() as a file and see what’s happening:

driver = webdriver.PhantomJS()

base_url = "http://6atxfootball.vbulletin.net/"

verificationErrors = []

accept_next_alert = True

driver.get(base_url)

content=driver.page_source

cleaner=clean.Cleaner()

content=cleaner.clean_html(content)    

with open('6atxfootball.html','w') as f:

   f.write(content.encode('utf-8'))

   doc=LH.fromstring(content)

the “6atxfootball.html” shows there isn’t any form to fill.

Apr 27, 2018 in Selenium by Martin
• 4,210 points
153 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You should try to directly log in to the url of the iframe, that is http://6atxfootball.vbulletin.net/auth/login-form. I think it's because it's inside an iframe. It would not be surprising that PhantomJS have some difficulties to find your element.

answered Apr 27, 2018 by Samarpit
• 5,130 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to upload a resume to a website using selenium in python?

Use this code, this will help you: from ...READ MORE

answered Apr 20, 2018 in Selenium by Vardy
• 2,280 points
987 views
0 votes
1 answer

How to start with a POST request using Selenium?

No, you cannot do this. But you ...READ MORE

answered Jun 25, 2018 in Selenium by Meci Matt
• 9,400 points
1,072 views
+1 vote
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
60 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
432 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
49 views
0 votes
1 answer

How to click a span with given text using Selenium Python

If ALL_USA is subject to change, then ...READ MORE

answered Jul 26, 2018 in Selenium by Samarpit
• 5,130 points
1,175 views
0 votes
1 answer

How to open a browser window in full screen using Selenium WebDriver with C#

Simply Use this: driver.Manage().Window.Maximize(); READ MORE

answered Jun 7, 2018 in Selenium by Samarpit
• 5,130 points
1,858 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.