1
我需要打开此页面上的搜索窗口。使用硒和幻影开关框架
https://permits.losgatosca.gov/CitizenAccess/default.aspx
与Firefox是工作得很好,但是当我尝试做相同的phantomJS我得到了一个错误。
这是我用来打开搜索
BUTTON_id = 'ctl00_PlaceHolderMain_TabDataList_TabsDataList_ctl01_LinksDataList_ctl00_LinkItemUrl' #'//*[@id="ctl00_PlaceHolderMain_TabDataList_TabsDataList_ctl01_LinksDataList_ctl00_LinkItemUrl"]/span'
driver_1.switch_to_frame("ACAFrame")
button = driver_1.find_element_by_id(BUTTON_id)
button.click()
的代码,这是我与phanthomJS得到错误:
Message: Error Message => 'Unable to switch to frame'
在this后它说,使用:
driver.switchTo().frame(frame_index)
driver.switchTo().frame(frame_id)
driver.switchTo().frame(frame_object)
它解决了这个问题,但我不知道该写什么:
frame_index
frame_id
frame_object
您是否在页面上测试它?我得到这个错误:raise timeoutException(消息,屏幕,stacktrace) selenium.common.exceptions.TimeoutException:消息: 屏幕截图:可通过屏幕 –
@LuisRamonRamirezRodriguez yup,为我工作。我有一个更新的答案,确保你已经尝试了最新版本的答案 – alecxe
它工作得很好。有没有办法优化等待时间? –