Give wrong output

Question:

from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
import pandas as pd
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
import pandas as pd



options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1920x1080")
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
wait = WebDriverWait(driver, 10)

url = "https://www.askgamblers.com/online-casinos/reviews/casino-friday"
driver.get(url)

product=[]
soup = BeautifulSoup(driver.page_source,"lxml")


responsibles=soup.select("div#tabResponsible")

for responsible in responsibles:
    t1=responsible.select_one(".icon-deposit-limit-tool+ span")
    if "<span class="">Deposit Limit Tool</span>" in t1:
        print("yes")
    elif "<span class='strikethrough'>Deposit Limit Tool</span>" in t1:
        print("no")         

I want my output in yes or no but everytime they give me no if there is no line on it then they print yes other wise they print no as you see in pic kindly want I am do wrong there you suggest me solution these is the page link https://www.askgamblers.com/online-casinos/reviews/casino-friday

enter image description here

enter image description here

Asked By: Amen Aziz

||

Answers:

Full Code

from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
import pandas as pd
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
import pandas as pd


options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1920x1080")
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
wait = WebDriverWait(driver, 20)

url = "https://www.askgamblers.com/online-casinos/reviews/casino-friday"
driver.get(url)


soup = BeautifulSoup(driver.page_source, "html.parser")

responsibles = soup.find("div", {"id": "tabResponsible"})
responsibles = responsibles.find_all("div", {"class": "review-details__item"})
Title = []
Value = []
for i in responsibles:
    if (i.find("span", {"class": "strikethrough"})):
        Title.append(i.find("span").text.strip())
        Value.append("No")
        print(i.find("span").text.strip(), ": ", "No")
    else:
        Title.append(i.find("span").text.strip())
        Value.append("Yes")
        print(i.find("span").text.strip(), ": ", "Yes")
# dictionary of lists to Dataframe
mydict = {'Title': Title, 'Value': Value, }
df = pd.DataFrame(mydict)

# saving the dataframe
df.to_csv('output.csv')
print(df)

Output

Deposit Limit Tool :  Yes
Wager Limit Tool :  No
Loss Limit Tool :  No
Time/Session Limit Tool :  No
Self-Exclusion Tool :  Yes
Cool Off/Time-Out Tool :  Yes
Reality Check Tool :  No
Self-Assessment Test :  Yes
Withdrawal Lock :  No
Self-Exclusion Register Participation :  Yes
                                   Title Value        
0                     Deposit Limit Tool   Yes        
1                       Wager Limit Tool    No        
2                        Loss Limit Tool    No        
3                Time/Session Limit Tool    No        
4                    Self-Exclusion Tool   Yes        
5                 Cool Off/Time-Out Tool   Yes        
6                     Reality Check Tool    No        
7                   Self-Assessment Test   Yes        
8                        Withdrawal Lock    No        
9  Self-Exclusion Register Participation   Yes 

Hope this helps. Happy Coding 🙂

Answered By: Amysoj-Louis