CopyPastor

Detecting plagiarism made easy.

Score: 0.8081596281177313; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-08-21
by Shreyash Sharma

Original Post

Original - Posted on 2019-06-19
by Jose Martínez Poquet



            
Present in both answers; Present only in the new answer; Present only in the old answer;



The problem is that you are trying to add the cookies with a different format than the selenium expects.
The python selenium api reference says that you have to insert the cookies with a dict like that
driver.add_cookie({'name' : 'foo', 'value' : 'bar'})
So you have to adapt your loop to use a key,value format
for cookie in cookies: driver.add_cookie({'name' : key, 'value' : value})
The problem is that you are trying to add the cookies with a different format than the selenium expects.
The [python selenium api reference][1] says that you have to insert the cookies with a dict like that
driver.add_cookie({'name' : 'foo', 'value' : 'bar'})

So you have to adapt your loop to use a key,value format
for key, value in pickle.load(open(r'{0}\{1}_cookie.pkl'.format(settings.COOKIES_PATH, self.tv_username), 'rb')): self.browser.add_cookie({'name' : key, 'value' : value})
[1]: https://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.add_cookie

        
Present in both answers; Present only in the new answer; Present only in the old answer;