Python Forum

Full Version: What am I doing wrong?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to wait for browser to see the first part of a string using:
            ltext = f"Page {sw['current_page']}"
            element = WebDriverWait(self.browser, delay).until( \
                EC.presence_of_element_located((By.PARTIAL_LINK_TEXT(ltext))))
value of sw['current_page'] is 2, so ltext is 'Page 2'
the page text is: 'Page 2 of 76, records 26 to 50 of 1878'
URL: https://bizfilings.vermont.gov/online/BusinessInquire/

receiving the following error:
Error:
Traceback (most recent call last): File ".../src/Vermont/ScrapeVermontBusinesses.py", line 178, in <module> main() File ".../src/Vermont/ScrapeVermontBusinesses.py", line 175, in main svb.dispatch() File ".../src/Vermont/ScrapeVermontBusinesses.py", line 50, in dispatch self.get_main_page() File ".../src/Vermont/ScrapeVermontBusinesses.py", line 91, in get_main_page EC.presence_of_element_located((By.PARTIAL_LINK_TEXT(ltext)))) TypeError: 'str' object is not callable
Waiting on Partial text is new to me, what am I doing wrong?
Try this:
EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, ltext)))
Reference: https://selenium-python.readthedocs.io/w...icit-waits
DeaD_EyE Wrote:Try this:

EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, ltext)))

This works properly, thanks.

I had another (novice) error as well, forgot to increment page number.