Selenium fetches URL but wont click href - no error in console

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Selenium fetches URL but wont click href - no error in console

Jonathan Clark

I am running Selenium to test a specific area of my companies webpage. What I am trying to do seems relatively easy in theory, but I have ran into several obstacles. Can someone please tell me why the URL is opening but won't select the "Services" Hyperlink?

Below is a snippet of the code:

 System.setProperty("webdriver.ie.driver",
"Path to IE/IEDriverServer_64.exe");

WebDriver driver = new InternetExplorerDriver();

DesiredCapabilities caps = DesiredCapabilities.internetExplorer();



driver.get("https://www.ups.com/us/en/Home.page");
driver.manage().window().maximize();

driver.findElement(By.xpath(".//*/div[@id='ups-header']/nav[@id='ups- 
navItems']/ul[@class='ups-navItems_primary']/li[@class='ups-navMenu ups- 
menu'][3]/a[@id='ups-menuLinks2']")).click();

As I stated earlier, in theory this should open up UPS's homepage and select the "Services" tab on the top right of the page. Instead it just goes to UPS.com homepage and stays there.

I have driver.findElement(By.xpath........); in this example but I have tried findElement(By.name & partialLinkText

Can anyone give me a solution besides update to latest version(s)?

Metadata: Windows 10, JAVA 10, Internet Explorer (Unfortunately) 11.4.

Thanks in advance!



--
Thanks,

Jonathan

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAOEoz_BcFtPJp1cc8m5rddZ%3D6LcKjwJBrnFBYRpRXAraO3PzJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.