Feb-28-2020, 01:42 PM
There is problem with your setup here @charset.
Here is more modern way to set up,here use Firefox an these setup option may be required,
it can also depend on version of driver and Selenium which should be the newest.
So it call
Find_Elements_By_Css_Selector
it should not be capitalized,will give AttributeError
.Here is more modern way to set up,here use Firefox an these setup option may be required,
it can also depend on version of driver and Selenium which should be the newest.
from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.common.keys import Keys import time, random #--| Setup options = Options() #options.add_argument("--headless") caps = webdriver.DesiredCapabilities().FIREFOX caps["marionette"] = True browser = webdriver.Firefox(options=options, capabilities=caps, executable_path=r"geckodriver.exe") #--| Parse or automation rand_page = random.randint(1, 5) url = f"https://eksisozluk.com/mustafa-kemal-ataturk--34712?p={rand_page}" browser.get(url) time.sleep(2) content = browser.find_elements_by_css_selector('.content') print(content)Work in test,content will return a list of Selenium objects.
So it call
.text
on it,will see content.>>> content[0].text '(bkz: ubermensch)' >>> content[1].text '(bkz: deha)\n(bkz: dusunce)\n(bkz: gorus)\n(bkz: zeka)\n(bkz: basari)' >>> content[2].text ("kutsal kehanetlerde adi gecen '19 yy da ortadogudan bir adam cikacak ve tum " "dunyaya kafa tutacak' dedigi , yuce insan, 4 kusak ileriyi gorebilen, esi " 'bulunmaz bir yasam insani, arif, yol gosterici')