La consultazione del forum è libera per tutti.
Per poter porre un quesito è invece necessario essere un utente registrato (clicca qui se non lo sei).
Tutti gli utenti che richiedono un supporto, come da REGOLAMENTO, sono caldamente invitati ad allegare un file di esempio con l'indicazione di quello che si desidera ottenere.
Buonasera a tutti.
Ho un Edge Versione 121.0.2277.83 (Build ufficiale) (64 bit) su Windows 11 (64) e vorrei richiamarci un sito in modalità IE.
Col driver IE (32-bit, 2.48.0.4) dell'installazione di Selenium non se ne fa nulla: errore (non trova il browser).
Col driver IEDriverServer (32-bit, 4.14.0.0, messo sia nella cartella Selenium Basic che in C:\Program Files (x86)\Microsoft WebDriver, e PATH personale e di sistema ci punta), ottengo "Tipo definito dall'utente non definito" con "Private slnDriver As New Selenium.IEDriverServer".
Col driver Edge (120.0.2210.144) sono arrivato a buon punto. Ho scritto la Function (nella quale ho settato 3 preference sulla richiesta di usare modalità IE e l'inserimento dell'URL tra quelli da eseguire in IE per 30 giorni) sotto:
Public Function blnSwitchToIE(slnEdgeDriver As Selenium.EdgeDriver, strUrl As String) As Boolean Const strUrlPreferenceIE As String = "edge://settings/defaultBrowser" Const strFullXpathDropDownListPermitIE As String = "/html/body/div[1]/div/div[2]/div/div/div[2]/div/div/div[2]/div[2]/div/div[1]/div/div[1]/div[2]/div/div/button/span/div" Const strFullXPathButtonAddUrlIE As String = "/html/body/div[1]/div/div[2]/div/div/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div[1]/div[2]/button" Const strFullXPathInsertUrlIE As String = "/html/body/div[2]/div/div/div/div[2]/div/div[2]/div/form/input" Const strFullXPathSubmitUrlIE As String = "//*[@id=""modal-root""]/div/div/div/div[2]/div/div[2]/div/form/div/button[1]" Const strPreferenceMayUseIE As String = "edge.compatMode.IE" Const strPreferenceUseIEWithDebug As String = "msedge.enable-experimental-features" Const strPreferenceEnableDebug As String = "edge.debugging.remoteEnabled" On Error GoTo ExitError slnEdgeDriver.SetPreference strPreferenceMayUseIE, True slnEdgeDriver.SetPreference strPreferenceUseIEWithDebug, True slnEdgeDriver.SetPreference strPreferenceEnableDebug, False slnEdgeDriver.Get strUrlPreferenceIE slnEdgeDriver.FindElementByXPath(strFullXPathButtonAddUrlIE).Click slnEdgeDriver.FindElementByXPath(strFullXPathInsertUrlIE).SendKeys (strUrl) slnEdgeDriver.FindElementByXPath(strFullXPathSubmitUrlIE).Click blnSwitchToIE = True Exit Function ExitError: blnSwitchToIE = False End Function
... ed ho ottenuto di vedermi rispondere "Disabilita il debug remoto per aprire questo sito nella modalità di InternetExplorer. Altrimenti potrebbe non funzionare come previsto".
Adesso? Come posso procedere? Ho esaurito ogni fantasia...
Ciao
Andrea
Qualcuno conosce qualche settaggio di Selenium (magari un elenco spiegato delle SetPreference)?
Intanto un ex collega mi ha girato una soluzione in altro linguaggio: queste sono le due righe che, richiamando IEDriverServer, in realtà richiama msedge.exe:
System.setProperty("webdriver.ie.driver", "D:\\User\\ChromeTest\\drivers\\IEDriverServer.exe");
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.attachToEdgeChrome();
ieOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
a parte che, come ho detto, non sono riuscito a far "digerire" IEDriverServer (vedi immagine), ma non so neppure come convertire le righe sopra in VBA!!!