Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97778

I'm automating a task using selenuim webdriver . How to fix : get() missing 1 required positional argument: 'url'

$
0
0

I'm creating a twitter bot that automatically likes every post in a hashtag and while getting the url using get() I'm getting this error :

get() missing 1 required positional argument: 'url' .

I've also tried get(url = 'https//twitter.com/') but it throws error that :

TypeError: get() missing 1 required positional argument: 'self'

How to fix this ?

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
class TwitterBot() :
    username , password = '' , ''
    bot = webdriver.Firefox
    def __init (self , username , password) :
        self.username = username
        self.password = password
        self.bot = webdriver.Firefox
        username = 'BitBot97561591'
        password = 'iambot'
    def login ( self ) :
        bot = self.bot
        bot.get('https://twitter.com/')
        time.sleep(3)
        user = bot.find_element_by_class_name('email-input')
        password = bot.find_element_by_name('session[password]')
        user.clear()
        password.clear()
        user.send_keys(self.username)
        password.send_keys(self.password)
        password.send_keys(Keys.RETURN)
        time.sleep(3)
    def liker ( self , hashtag ) :
        bot = self.bot
        bot.get('https://twitter.com/search?q='+hashtag+'t&src=typd')
        time.sleep(3)
        for i in range (1 , 5) :
            bot.execute_script('window.scrollTo(0,document.body.scrollHeight)')
            time.sleep(2)
            tweets = bot.find_elements_by_class_name('tweet')
            links = [elem.get_attribute('data-permalink-path') for elem in tweet]
            for link in links :
                bot.get('https://twitter.com/'+link)
                try :
                    bot.find_element_by_class_name('HeartAnimation').click()
                    time.sleep(5)
                except Exception as ex :
                    time.sleep(10)
tweet = TwitterBot()
tweet.login()
tweet.liker('webdevelopment')

I expect to open firefox browser , enter email and password and like all the posts in a hashtag .


Viewing all articles
Browse latest Browse all 97778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>