Kiryl K
Kiryl K

Reputation: 75

How to manage pop-up using Selenium Web Driver in github

I'm having troubles with managing of the pop-up in the github. Test case which I'd like to automate is: 1. Go to https://github.com/YOUR_USER/YOUR_REPO/settings 2. Click "Delete Repository" button (pop-up appears) 3. Fill in the name of your repository into the input in pop-up 4. Click "I understand the consequences, delete this repository" the button in pop-up

I don't know how to find the element in pop-up in the 3d step. When I'm just tryin' to do this, webdriver fails to find element

driver.findElement(By.name("verify")).sendKeys(repoName);

Upvotes: 0

Views: 103

Answers (2)

AGill
AGill

Reputation: 778

Following locator (css selector) should work:

#facebox .input-block"

Use this locator as follows:

driver.findElement(By.cssSelector("#facebox .input-block")).sendKeys(repoName);

Another css selector that you can use is as follows:

#facebox [name=verify]

driver.findElement(By.cssSelector("#facebox [name=verify]")).sendKeys(repoName);

Upvotes: 1

JRodDynamite
JRodDynamite

Reputation: 12613

There are more that one input tags with the same name attribute value "verify". You need to select the second one and not the first. You can try something like this:

driver.findElements(By.name("verify"))[1].sendKeys(repoName);

Upvotes: 1

Related Questions