Autum
Autum

Reputation: 1

Element Not Interactable even after moving to the element and explicitly waiting in Selenium Java

When I click into the vendor box it pops up with a list of options that you can scroll to or type what you want and select. The box has a clear id and is definitely interactable on the actual page but when I run the test it just says element is not interactable.

I've read other threads and have tried to use Actions to move to the element and to explicitly wait which when I have done, has thrown an error "waiting for visibility of the element". //Attempt to move to the element

    Actions action = new Actions(driver);
    action.moveToElement(driver.findElement(By.id(TransactionUIConstants.VENDOR_SEARCH)));

    WebDriverWait wait = new WebDriverWait(driver, Page.TIMEOUT);
    wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("vendor")))); 
    wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.id("vendor"))));
    //What I'm trying to click

    driver.findElement(By.id("vendor")).click();
    driver.findElement(By.id("vendor")).sendKeys("Amazon");
    driver.findElement(By.id("vendor")).sendKeys(Keys.ENTER);

Here's the description from the inspect tab:

input name="" id="vendor" type="text" autocomplete="nope" placeholder="Select option" tabindex="0" class="multiselect__input" style="width: 0px; position: absolute; padding: 0px;"

Upvotes: 0

Views: 254

Answers (5)

Vinothini93
Vinothini93

Reputation: 1

/**
   * Uses email.username and email.password properties from the properties file. Reads from Inbox folder of the email application
   * @throws MessagingException
   */
  public EmailUtils() throws MessagingException {
    this(EmailFolder.INBOX);
  }

  /**
   * Uses username and password in properties file to read from a given folder of the email application
   * @param emailFolder Folder in email application to interact with
   * @throws MessagingException
   */
  public EmailUtils(EmailFolder emailFolder) throws MessagingException {
    this(getEmailUsernameFromProperties(),
        getEmailPasswordFromProperties(),
        getEmailServerFromProperties(),
        emailFolder);
  }

  /**
   * Connects to email server with credentials provided to read from a given folder of the email application
   * @param username Email username (e.g. [email protected])
   * @param password Email password
   * @param server Email server (e.g. smtp.email.com)
   * @param emailFolder Folder in email application to interact with
   */
  public EmailUtils(String username, String password, String server, EmailFolder emailFolder) throws MessagingException {
    Properties props = System.getProperties();
    try {
      props.load(new FileInputStream(new File("resources/email.properties")));
    } catch(Exception e) {
      e.printStackTrace();
      System.exit(-1);
    }

    Session session = Session.getInstance(props);
    Store store = session.getStore("imaps");
    store.connect(server, username, password);


    folder = store.getFolder(emailFolder.getText());
    folder.open(Folder.READ_WRITE);
  }

Upvotes: 0

Vinothini93
Vinothini93

Reputation: 1

utility class- 2

 private Folder folder;

  public enum EmailFolder {
    INBOX("INBOX"),
    SPAM("SPAM");

    private String text;

    private EmailFolder(String text){
      this.text = text;
    }

    public String getText() {
      return text;
    }
  }

Upvotes: 0

Vinothini93
Vinothini93

Reputation: 1

mail.smtp.host=smtp.gmail.com
mail.smtp.socketFactory.port=465
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.auth=true
mail.smtp.port=465
mail.transport.protocol=smtp


resource folder-1

Upvotes: 0

Vinothini93
Vinothini93

Reputation: 1

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>javax.mail-api</artifactId>
        <version>1.5.5</version>
    </dependency>

    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>smtp</artifactId>
        <version>1.6.0</version>
    </dependency>

    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>javax.mail</artifactId>
        <version>1.6.0</version>
    </dependency>

Upvotes: 0

sanj
sanj

Reputation: 16

If it has select tag you can try using select class. I am assuming that it might be a multiselect dropdown

Upvotes: 0

Related Questions