TimeoutException Due To A Change Of Tags?
I am having some problems with TimeoutException. My code has always run fine in the past days but today something has changed since I am getting the TimeoutException error message.
Solution 1:
Your paths are incorrect. I assume the html has changed. You could use:
message = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR,".trustdata-alert strong:last-child"))).text
t_score = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, ".trustscore-rating"))).text
However,
You need a better wait condition as the rating can be slow to fully update leading to printing an incorrect value.
There are anti-bot cloudflare measures meaning scraping is likely against T&C and you will get a captcha at some point and possibly a ban.
Solution 2:
Not sure what HTML the website had earlier, But I do this outer HTML for Trustscore.
<div class="trustscore-rating"><span style="color: rgb(0, 177, 106);">100</span> / 100</div>
I have looked upon the HTMLDOM and we have a a unique entry for this div.
Please use this css_selector :
div.trustscore-rating
Code 1 :
message = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.trustscore-rating"))).text
or
message = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.trustscore-rating"))).get_attribute('innerText')
Post a Comment for "TimeoutException Due To A Change Of Tags?"