I have the following code in my script:
page.click("#first-input", timeout=10)
page.click('label[for="trip-go"]', timeout=10)
month_span_visible = page.isVisible(".rf-daterange-picker-alternative__month-label")
print("Month span visible:", month_span_visible) # <- Prints True
# page.awaitSelector(".rf-daterange-picker-alternative__month-label", timeout=10) # <- Would also succeed here
month_span: BrowserSession = page.find(".rf-daterange-picker-alternative__month-label", timeout=10)
print("Month span found:", month_span) # <- Prints None
selected_month = month_span.find("span", timeout=10).text # <- Raises here because month_span is None
>> Month span visible: True
>> Month span found: None
>> selected_month = month_span.find("span", timeout=10).text
>> ^^^^^^^^^^^^^^^
>> AttributeError: 'NoneType' object has no attribute 'find'
The methods page.isVisible and page.awaitSelector succeed for the .rf-daterange-picker-alternative__month-label selector, but page.find for the same selector returns None immediately after.
If the selector is visible and exists, why can't it be found with page.find?
My theory is that the html content that page.find uses (internally page.html.find) isn't properly updated after the click, but I do not know for sure why that is.
I have the following code in my script:
The methods
page.isVisibleandpage.awaitSelectorsucceed for the.rf-daterange-picker-alternative__month-labelselector, butpage.findfor the same selector returns None immediately after.If the selector is visible and exists, why can't it be found with page.find?
My theory is that the html content that page.find uses (internally page.html.find) isn't properly updated after the click, but I do not know for sure why that is.