简体   繁体   English

TypeError:get() 缺少 1 个必需的位置参数:function 中的“url”错误

[英]TypeError: get() missing 1 required positional argument: 'url' error in function SOLVED

Normally I can work get method.通常我可以使用get方法。 But, when ı put get method in my function I get an error message.但是,当我将 get 方法放入我的 function 时,我收到一条错误消息。 Also Im looked at a python selenium videos and that guy never got an error.我还看了一个 python selenium 视频,那个人从来没有出错。 Im using same code but I got this error.我使用相同的代码,但出现此错误。 How can I solve this problem?我怎么解决这个问题? My ide:Pycharm my code:我的 ide:Pycharm 我的代码:

from instagramuserinfo import username, password
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
class Instagram:
    def __init__(self,username,password):
        self.browser = webdriver.Chrome
        self.username=username
        self.password=password
    def signIn(self):
        self.browser.get("https://www.instagram.com/accounts/login/")
        usernameInput=self.browser.find_elements_by_xpath('//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[2]/div/label/input')
        passwordInput=self.browser.find_elements_by_xpath('//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[3]/div/label/input')
        usernameInput.send_keys(self.username)
        passwordInput.send_keys(self.password)
        passwordInput.send_keys(Keys.ENTER)
        time.sleep(3)
instagram=Instagram(username,password)
instagram.signIn() 

-----------------------------------------------
error message:
Traceback (most recent call last):
  File "C:/Users/Turkmen/Desktop/pythonkursbtk/selenium/insta.py", line 19, in <module>
    instagram.signIn()
  File "C:/Users/Turkmen/Desktop/pythonkursbtk/selenium/insta.py", line 11, in signIn
    self.browser.get("https://www.instagram.com/accounts/login/")
TypeError: get() missing 1 required positional argument: 'url'

Im forgot brackets.我忘了括号。 self.browser = webdriver.Chrome() self.browser = webdriver.Chrome()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Class 中的 Function 错误:TypeError:函数()缺少 1 个必需的位置参数: - Function in Class error: TypeError: function() missing 1 required positional argument: 类型错误:request() 缺少 1 个必需的位置参数:&#39;url&#39; - TypeError: request() missing 1 required positional argument: 'url' 类型错误:initialize() 缺少 1 个必需的位置参数:&#39;url&#39; - TypeError: initialize() missing 1 required positional argument: 'url' TypeError:Openurl()缺少1个必需的位置参数:“ url” - TypeError: Openurl() missing 1 required positional argument: 'url' 类型错误:get() 缺少 1 个必需的位置参数:使用 GeckoDriver 和 Firefox 到 Selenium 和 Python 时出现“url”错误 - TypeError: get() missing 1 required positional argument: 'url' error using GeckoDriver and Firefox through Selenium and Python 类型错误:get() 缺少 1 个必需的位置参数:“self” - TypeError: get() missing 1 required positional argument: 'self' “ TypeError:缺少1个必需的位置参数”实例错误 - “TypeError: missing 1 required positional argument” Instance error Python错误:TypeError:…缺少1个必需的位置参数: - Python ERROR: TypeError: … missing 1 required positional argument: get() 缺少 1 个必需的位置参数:&#39;url&#39; - get() missing 1 required positional argument: 'url' Scrapy:TypeError:__init __()缺少1个必需的位置参数:&#39;url&#39; - Scrapy: TypeError: __init__() missing 1 required positional argument: 'url'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM