Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What am I doing wrong?
#1
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?
Reply
#2
Try this:
EC.presence_of_element_located((By.PARTIAL_LINK_TEXT, ltext)))
Reference: https://selenium-python.readthedocs.io/w...icit-waits
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Django serving wrong template at the wrong address with malformed urls.py (redactor a Drone4four 2 2,586 Aug-17-2020, 01:09 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020