0

I am trying to verify the loaded extension in the firefox but the code is not working for me the html is attached and the xpath is //*[@name="extension"]

On firefox browser open url about:addons

html Extensions

The firefox version is 77 and geckodriver 0.26. I am getting exception element not found

2 Answers2

0

Use like this:

 //Wait for element to be clickable
    WebDriverWait wait = new WebDriverWait(driver, 15);
    wait.until(ExpectedConditions.elementToBeClickable(By.name("extension")));

    driver.findElement(By.name("extension")).click();
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
0

As per the html you have provided to click on the loaded extension you have to induce WebDriverWait for the element to be clickable and can you can use either of the following Locator Strategies:

  • and

    # imports
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC        
    
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.category[name='extension']>span[class='category-name'][data-l10n-id='addon-category-extension']"))).click()
    
  • and

    new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='category' and @name='extension']/span[@class='category-name' and text()='Extensions']"))).click();
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • The issue is, not able to locate the element even though have waited 10 seconds to load the page. Tried testing it from the console also it fails to locate the element. Check the page about:addons. – sourabh rawat Jun 15 '20 at 03:08
  • @sourabhrawat Instead of asking the contributors to check the page, you need to update the question with as much as possible information you can provide, starting with text based relevant HTML. I know the issue but still I would like to see you asking the question right. – undetected Selenium Jun 15 '20 at 03:18
  • ..Thanks for your suggestion ..I have mentioned the URL in the comment as well and was not able to copy the html text that why I have put the screenshot of it..if you know the question then you should post only if you know the correct solution for it – sourabh rawat Jun 15 '20 at 05:40
  • 1
    Hi. The html can be copied with right click on the `body` element , then `Copy as outerHTML`. Posted solutions are OK. You should probably post the version number of Selenium, geckodriver and Firefox you use. Post also the error message you get. – E.Wiest Jun 15 '20 at 15:54
  • Hey..not able to paste the html text coying it here. – sourabh rawat Jun 16 '20 at 06:27