Replies: 6 comments 5 replies
-
We designed |
Beta Was this translation helpful? Give feedback.
-
about "WaitUntilDisplayed", could you teach me how can i write it? set xx = driver.findelementxpat("xxxxxxx").WaitUntilDisplayed(1000), is this format right? |
Beta Was this translation helpful? Give feedback.
-
Yes @Arvin-fang-ui, both these formats are fine: |
Beta Was this translation helpful? Give feedback.
-
https://github.com/GCuser99/SeleniumVBA/wiki#managing-windows |
Beta Was this translation helpful? Give feedback.
-
It's hard for me to tell because I don't know what line in your code the automation error occurs. Probably on a line that is not shown in your pic? It's much easier for us to try to help you if you can give us minimal reproducible code that we can try on our own systems to help debug. So I'll help get this started - try this and let us know what happens: Sub test_file_download()
Dim driver As SeleniumVBA.WebDriver
Dim caps As SeleniumVBA.WebCapabilities
Set driver = SeleniumVBA.New_WebDriver
'assign your folder path here - you can use Environ("USERPROFILE") to hide your username(s)
downloadFolderPath = Environ("USERPROFILE") & "\Desktop\New folder"
driver.DefaultIOFolder = downloadFolderPath
'qc default io path - these two should be same
Debug.Assert driver.DefaultIOFolder = driver.ResolvePath("./")
Debug.Print driver.DefaultIOFolder
driver.StartEdge ("C:\SeleniumBasic\msedgedriver.exe")
Set caps = driver.CreateCapabilities
caps.SetDownloadPrefs downloadFolderPath:=downloadFolderPath
driver.OpenBrowser caps
driver.NavigateTo "https://www.selenium.dev/selenium/web/downloads/download.html"
driver.Wait 500
'start with a clean folder
driver.DeleteFiles downloadFolderPath & "\file_1.txt", downloadFolderPath & "\file_2.jpg"
'download the files
driver.FindElementByCssSelector("#file-1").Click
driver.WaitForDownload downloadFolderPath & "\file_1.txt"
driver.FindElementByCssSelector("#file-2").Click
driver.WaitForDownload downloadFolderPath & "\file_2.jpg"
'if we get here then so far so good!
'let's try again using paths relative to DefaultIOFolder
driver.DeleteFiles ".\file_1.txt", ".\file_2.jpg"
driver.FindElementByCssSelector("#file-1").Click
driver.WaitForDownload ".\file_1.txt"
driver.FindElementByCssSelector("#file-2").Click
driver.WaitForDownload ".\file_2.jpg"
driver.CloseBrowser
driver.Shutdown
End Sub |
Beta Was this translation helpful? Give feedback.
-
The line One more thing - why are you specifying |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Just a quick question: for a consistent user/programmer experience - wouldn't it be logical to use the ImplicitMaxWait as default for the max wait time in WaitUntilDisplayed ?
Beta Was this translation helpful? Give feedback.
All reactions