Replies: 1 comment 6 replies
-
|
If you click an element from a list of items and and it takes you to a different page, then the remaining elements in that list won't exist anymore on the new page. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My program needs to perform an automated operation, clicking each div in sequence. However, after the final page dynamically loads the dropdown, the click function becomes stuck, and the entire program becomes unresponsive
It's quite strange, but in debug mode, testing line by line is possible
import asyncio
from seleniumbase.core import sb_cdp
from seleniumbase.undetected.cdp_driver import cdp_util
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
host = "127.0.0.1"
port = 9222
driver = loop.run_until_complete(cdp_util.start(host=host, port=port))
page = loop.run_until_complete(driver.get("https://www.zhipin.com/web/geek/jobs?query=java&city=101270100&industry=&position="))
sb = sb_cdp.CDPMethods(loop, page, driver)
sb.maximize()
sb.sleep(2)
for i in range(2):
sb.scroll_into_view('//div[@Class="job-list-container"]/ul/div[last()]')
sb.sleep(2)
TotalDelivery = 0
cycles = 1
def explz(sum):
global TotalDelivery
# city = sb.find_element("city-label active") #点击选择求职的城市
# city.gui_click()
# sb.sleep(2)
# ccity = sb.find_element('//li[text()="重庆"]') #确认选择
# sb.sleep(2)
# ccity.gui_click()
explz(cycles)
print("{} {}".format("执行完成 总共投递", TotalDelivery))
Beta Was this translation helpful? Give feedback.
All reactions