Any help would be much appreciated.
I want my program to log into indeed.ca (this is working, as long as you enter correct user credentials), navigate to a specific job posting(working), click on the first orange apply button(working), an iframe pops up.
Then I want to click on the blue apply button in iframe that appears. "apply with a different resume?" link (if you are not logged in with indeed you won't see this.)
If you don't have an indeed account, and want to help, just try to click on any link in the pop-up iframe. Example: try to click "Create one now" link
The below code worked 2 weeks ago, but now it seems Indeed.ca made a minor change to site and code is broken
import java.io.IOException;
import java.util.ArrayList;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Test {
//IOException, InterruptedException, NoSuchElementException
public static void main(String[] args) throws IOException, InterruptedException, NoSuchElementException {
System.setProperty("webdriver.gecko.driver", "C:\\Users\\Padoga\\Documents\\geckodriver-v0.18.0-win64\\geckodriver.exe");
try {
FirefoxDriver driver = new FirefoxDriver();
driver.get("https://secure.indeed.com/account/login?service=my&hl=en_CA&co=CA");
driver.findElement(By.xpath("//*[@id=\"signin_email\"]")).sendKeys("youremail@email.com");
driver.findElement(By.xpath("//*[@id=\"signin_password\"]")).sendKeys("password");
driver.findElement(By.xpath("//*[@id=\"loginform\"]/button")).click();
driver.navigate().to("https://ca.indeed.com/viewjob?jk=ff97666702741fef&q=marketing&l=Toronto%2C+ON&tk=1boluh7om5igq9ng&from=web");
// int size = driver.findElements(By.tagName("iframe")).size();
// System.out.println(size);
Thread.sleep(3000);
//click orange "apply now" button
driver.findElement(By.xpath("//*[@id=\"apply-state-picker-container\"]/div[1]/span[1]")).click();
Thread.sleep(3000);
//don't believe this is working now - below used to switch to correct pop-up iframe
driver.switchTo().frame(1);
driver.switchTo().frame(0);
//not working anymore -- click "apply with a different resume?" link
driver.findElement(By.xpath("\"//*[@id=\\\"form_container\\\"]/div[2]/div[1]/div[1]/p/a\"")).click();
//no longer reach below steps
//click on resume "choose file" button and upload resume
driver.findElement(By.id("resume")).sendKeys("C:\\Users\\Padoga\\resumes\\Resume.pdf");
//click blue apply button
driver.findElement(By.id("apply-div")).click();
}
catch(Exception e){
//System.out.println(e.getMessage());
}
// driver.quit();
}
}