I want to print/get only visible text content {currently what the user is seeing} from any website.
I tried using multiple approaches and I am getting all the texts from the page but not the intended texts.
driver = webdriver.Chrome(chrome_options=options) #'CustomerProject-createCustomerProject&/Create'
url = "https://techcrunch.com/"
driver.get(url)
element = driver.find_element_by_xpath(r"//body")
driver.execute_script("return arguments[0].innerText", element)
Is there any way to get only visible texts.
Note: If the solution is pure javascript, more than welcome.