none
Como converter esse codigo em Java para VBA? RRS feed

  • Pergunta

  • // Generated by Selenium IDE
    import org.junit.Test;
    import org.junit.Before;
    import org.junit.After;
    import static org.junit.Assert.*;
    import static org.hamcrest.CoreMatchers.is;
    import static org.hamcrest.core.IsNot.not;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.remote.RemoteWebDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.Dimension;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.interactions.Actions;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;
    import org.openqa.selenium.JavascriptExecutor;
    import org.openqa.selenium.Alert;
    import org.openqa.selenium.Keys;
    import java.util.*;
    import java.net.MalformedURLException;
    import java.net.URL;
    public class Test11Test {
      private WebDriver driver;
      private Map<String, Object> vars;
      JavascriptExecutor js;
      @Before
      public void setUp() {
        driver = new FirefoxDriver();
        js = (JavascriptExecutor) driver;
        vars = new HashMap<String, Object>();
      }
      @After
      public void tearDown() {
        driver.quit();
      }
      @Test
      public void test11() {
        driver.get("https://onvio.com.br/");
        driver.manage().window().setSize(new Dimension(550, 694));
        driver.findElement(By.name("uid")).sendKeys("");
        driver.findElement(By.name("pwd")).click();
        driver.findElement(By.name("pwd")).sendKeys("");
        driver.findElement(By.name("pwd")).sendKeys(Keys.ENTER);
        driver.findElement(By.cssSelector(".bento-icon-hamburger-menu")).click();
        driver.findElement(By.cssSelector("#bm-header-app-menu .ng-scope:nth-child(2) .ng-scope")).click();
      }
    }
    sexta-feira, 15 de janeiro de 2021 14:31

Todas as Respostas

  • https://www.youtube.com/results?search_query=VBA+SELENIUM

    A melhor forma de agradecer e votar como util e / ou marcar como resposta. Anderson Diniz diniabr2011@gmail.com

    sexta-feira, 15 de janeiro de 2021 15:50
  • Vai precisar baixar/instalar o Selenium VBA, atualizar manualmente (na pasta do Selenium) o Chrome Driver pra versão atual e no Excel referenciar a biblioteca "Selenium Type Library"

    
    
    Sub Exemplo()   
      Dim driver As ChromeDriver
      Set driver = New ChromeDriver
      Dim Keys As Selenium.Keys 
      Set Keys = New Selenium.Keys 
    
      driver.get ("https://onvio.com.br/")
      driver.Window.SetSize 550, 694  
      driver.FindElementByName("uid").SendKeys ("") 
      driver.FindElementByName("pwd").Click    
      driver.FindElementByName("pwd").SendKeys ("")  
      driver.FindElementByName("pwd").SendKeys (Keys.Enter) 
      driver.FindElementByCss(".bento-icon-hamburger-menu").Click  
      driver.FindElementByCss("#bm-header-app-menu .ng-scope:nth-child(2) .ng-scope").Click
    End Sub


    sábado, 27 de fevereiro de 2021 14:52