Python2.7 Selenium Errors
So I recently transfered too python 2.7 from python 3.5 due to not being able to use py2exe, But I had this script running on 3.5 but now I get an error in 2.7 if you guys could gi
Solution 1:
Try inserting these lines after print(post2.text)
A=post2.text
A=A.encode('ascii','ignore')
And instead of text_file.write(post2.text + "\n")
write text_file.write(A + "\n")
It worked for me.
to debug next button issue try the following code:
for n in range(10):
nextbutton = 0
try:
nextbutton = driver.find_element_by_xpath("//*[@id='pnnext']/span[2]")
if nextbutton !=0 :
nextbutton.click()
except: pass
time.sleep(5)
if nextbutton != 0 or n==0:
posts2 = driver.find_elements_by_class_name("_Rm")
for post2 in posts2:
print(post2.text)
A=post2.text
A=A.encode('ascii','ignore')
text_file.write(A + "\n")
Post a Comment for "Python2.7 Selenium Errors"