I've added the HTML and the scraper I've written. I want the p (2 p tags) tags content to be printed in 1 line. Like Precious Achiuwa. Then in the next line, I want to print the other 2 p element content.
<td class="primary text RosterRow_primaryCol__19xPQ">
<a class="flex items-center t6 Anchor_complexLink__2NtkO" href="/player/1630173/precious-achiuwa/">
<div class="w-8 h-8 mr-2">
<img alt="Precious Achiuwa Headshot" class="PlayerImage_image__1smob PlayerImage_round__281uY" loading="lazy" src="https://cdn.nba.com/headshots/nba/latest/260x190/1630173.png"/>
</div>
<div class="flex flex-col lg:flex-row">
<p class="t6 mr-1">
Precious
</p>
<p class="t6">
Achiuwa
</p>
</div>
</a>
</td>
from selenium import webdriver
from bs4 import BeautifulSoup as bs
driver = webdriver.Chrome(
executable_path=r'C:\Users\silvi\projects\selenium_basics\chromedriver.exe')
url = 'https://www.nba.com/players'
driver.get(url)
soup = bs(driver.page_source, 'lxml')
info_box = soup.find('table', class_='players-list')
names = info_box.find_all('p')
for name in names:
r = name.get_text(' ', strip=True)
print(r)
driver.quit()