Selenium Java Element not interactable

Viewed 64

Im trying to get into java/selenium but i have some problems i cant solve.

  1. I cant interact with the "WEITER" Button from the website Snipes.com (https://www.snipes.com/checkout?stage=payment#payment). It works with every other button but the box of this one looks a little bigger than the button itself. Perhaps this is the problem but i dont know how i can only click the button.element not intractable

The code im using for this part is following:

TimeUnit.MILLISECONDS.sleep(500); //select Paypal as Payment
            selectPayment = driver.findElementByXPath("/html/body/div[3]/div[2]/div/div/div[2]/div[1]/div[3]/div[2]/div/div/form/div/ul/li[1]/div[1]/label");
            js.executeScript("arguments[0].scrollIntoView(true);", selectPayment);
            js.executeScript("arguments[0].click();", selectPayment);
            TimeUnit.MILLISECONDS.sleep(500);
            nextButtonCheckout = driver.findElementByXPath("/html/body/div[3]/div[2]/div/div/div[2]/div[1]/div[3]/div[2]/button");
            nextButtonCheckout.click(); //click the "WEITER" Button
            TimeUnit.MILLISECONDS.sleep(200);

Is there any way to click only the "main" button element instead of the whole thing so i can interact with it?

  1. Error: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[5]/div/div/div/div/div1/button"}

whole error: https://pastebin.com/jki8T8Y4

region selector snipes

I want to click the little "x" on the top right of this pop up and sometimes it works but sometimes it doesnt. How can I test if it found the element and if not try again? I use proxies for this and the speeds are different so i cant just wait 5s and then check if it works. Sometimes the element can be found in 2s sometimes in 15s. I need to retry it a few times and my idea is to check it the variable 'selectRegion' if something is stored in it. I tried it with if(selectRegion =! "the output from the element") but i cant compare a WebElement with a String.

the code i use:

//Snipes Region + accept cookies
    driver.get("https://www.snipes.com/login");
    TimeUnit.SECONDS.sleep(7);
    

        
    selectRegion = driver.findElementByXPath("/html/body/div[5]/div/div/div/div/div[1]/button");
    selectRegion.click(); //click on the "x"
    System.out.println(selectRegion); //get the variable output the use it later for the retries
    
    acceptCookies = driver.findElementByXPath("/html/body/div[2]/div[2]/div/div[2]/div[2]/button");
    acceptCookies.click();
  1. This is a common problem but does anyone know how i can use user:passw authenticated proxies with selenium? Everytime i start it there is this authentication pop up but i cant interact with it.
0 Answers
Related