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,320 points
2,890 views
Can't answer an existing topic, what should I do ??  
 Maybe I'm doing something wrong?  
Please help.  
Thank you.
Can someone help how to answer a new topic ??
 Maybe I'm not writing correctly?
Please help.  
Thank you.
Is there any of the moderators, because I can not answer a new topic?  
 Maybe I'm doing something wrong?  
 Need your help.
 Yours faithfully.
Can't answer an existing topic, what should I do ??  
 Maybe I'm not writing correctly?
Please help.  
Thank you.
Hey there! I'm Stephen hailing from Norway. I specialize in customer support by day, but my heart truly belongs to the realm of SEO and digital marketing. I'm always on the lookout for ways to enhance my skills and keep pace with the ever-evolving trends and algorithms. In my free time, I enjoy immersing myself in nature's wonders or indulging in a Netflix marathon. Let's build connections and thrive together!
 
Areas of Expertise:
 
On-page SEO
Keyword research
Technical SEO
Local SEO
SEO tools and analytics
 
Looking Forward To:
 
Exchanging ideas and tactics
Learning from fellow SEO enthusiasts
Building meaningful connections within the industry

1 answer to this question.

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,910 points

Related Questions In Selenium

0 votes
1 answer

How to Select date from a datepicker with Selenium Webdriver using Python?

Hi Yashim, you can select date from ...READ MORE

answered Jul 31, 2019 in Selenium by Abha
• 28,140 points

edited Oct 7, 2021 by Sarfaraz 11,072 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
2 answers

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,500 points
14,145 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,412 views
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,910 points
7,468 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
8,028 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,910 points
7,505 views
0 votes
2 answers

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

You can maximize the window using the ...READ MORE

answered Jun 10, 2021 in Selenium by anonymous

edited Mar 5 16,345 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP