Error while executing selenium code

0 votes

Hello, I am using selenium to find blogs on AWS Migration from amazon. I am getting the following error:

Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"partial link text","selector":"www.amazon.com/"}


Can someone help me with this?

Here is the code that I used.

System.setProperty("webdriver.chrome.driver","C:\\Users\\Sradha\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.google.com");
        driver.findElement(By.name("q")).sendKeys("AWS Migration");
        driver.findElement(By.partialLinkText("www.amazon.com/"));
        Thread.sleep(4000);

Can someone help me with this?
 

Dec 28, 2018 in Selenium by Sradha
• 1,750 points
1,175 views

1 answer to this question.

0 votes

Hey @Sradha, First thing that I would like to tell you is, Amazon.com is a retail website.

https://aws.amazon.com is the website that handles all aws related contents.

Second, you are just searching for the key word and not clicking on search button. That's the reason you are getting error saying unable to locate the element.

Here is the code that I have used, take a look. Hope this will serve the purpose

System.setProperty("webdriver.chrome.driver","C:\\Users\\Nabarupa_Das\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
driver.findElement(By.name("q")).sendKeys("AWS Migration",Keys.ENTER);
driver.findElement(By.partialLinkText("https://aws.amazon.com/")).click();
Thread.sleep(4000);
answered Dec 28, 2018 by Nabarupa

Related Questions In Selenium

0 votes
1 answer

Java.lang.CharSequence cannot be resolved error while using sendKeys() using Selenium Webdriver

You could try this, myElement .sendKeys(new String[] { ...READ MORE

answered Apr 4, 2018 in Selenium by Johnathon
• 9,090 points
2,962 views
+1 vote
2 answers

Selenium IDE Click button error while clicking on Play Recording

Hello, There are a number of reasons that ...READ MORE

answered Nov 30, 2019 in Selenium by surbhi
• 260 points
1 flag 1,134 views
0 votes
1 answer

Firefox Error: “Your connection is not secure” while launching driver with Selenium 3.0.1 using Java

Download Firefox 55 beta and set capabilities.setCapability("acceptInsecureCerts", true); Here ...READ MORE

answered Sep 17, 2018 in Selenium by Meci Matt
• 9,460 points
1,086 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
7,718 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
7,124 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
4,831 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
6,005 views
0 votes
1 answer

Error: TestNG @BeforeClass initialization code not running before Test

Below will help: @BeforeTest: The annotated method will ...READ MORE

answered Jul 6, 2018 in Selenium by Samarpit
• 5,890 points
4,113 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP