Issue
<table class="sc-fAEnHe ePMtc">
<tbody>
<tr class="sc-fAEnHe ePMtc">
<td classs"sc-jEECVv IBUtl">
</td>
</tr>
When I use Selenium's Find element by class it is able to find the element, I even tried replacing space (after e and r or v and I) with ".", "-" and "_" but it did not worked. I Used The Code Below
try:
match_history_table = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.CLASS_NAME, 'sc-fAEnHe ePMtc'))
)
except Exception:
print("Error Finding Match History Table")
driver.quit()
It always returned the Exception (EC is selenium.webdriver.support.expected_conditions) >Note: Find Elements By Tag is not an Option For me
Solution
This is doc from By.CLASS_NAME
found in selenium-java-bindings.
Find elements based on the value of the "class" attribute. Only one class name should be used. If an element has multiple classes, please use cssSelector(String).
Try with (By.CSS_SELECTOR, '.sc-fAEnHe.ePMtc')
:
try:
match_history_table = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.sc-fAEnHe.ePMtc'))
)
except Exception:
print("Error Finding Match History Table")
driver.quit()
Referenses
- json wire protocol https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidelement
class name Returns an element whose class name contains the search value; compound class names are not permitted.
W3C webdriver
And class_name not mentioned in W3C protocol, so it might become legacy https://www.w3.org/TR/webdriver/#locator-strategies
Answered By - Max Daroshchanka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.