Hi I am facing an error which is mentioned below. I am unable to click on the button of Buyer as mentioned in the screenshot. I have tried wait, sleep functions too. But unable to move beyond this. Can anyone help me in it.
Can anyone please help me in this: Inspect Element code is .
Code is:
driver.findElement(By.name("login")).click(); //Click on login button
System.out.println("hello world-----4");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("hello world-----5");
WebElement element = driver.findElement(By.xpath("//*
[@id=\"modeuser\"]/div/ul/li[3]"));
((JavascriptExecutor)
driver).executeScript("arguments[0].scrollIntoView(true);", element);
element.click();
//Click on usertype
Error:
Exception in thread "main"
org.openqa.selenium.ElementNotInteractableException: Element <li
class="buyer_border changeusermode "> could not be scrolled into view
Build info: version: '3.9.0', revision: '698b3178f0', time: '2018-02-
05T14:56:13.134Z'
System info: host: 'CLAVAX-PC-93', ip: '192.168.2.122', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox,
browserVersion: 58.0.2, javascriptEnabled: true, moz:accessibilityChecks:
false, moz:headless: false, moz:processID: 14260, moz:profile:
C:\Users\Rahul\AppData\Loca..., moz:webdriverClick: true, pageLoadStrategy:
normal, platform: XP, platformName: XP, platformVersion: 10.0, rotatable:
false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
HTML is :
<div class="right hide-on-med-and-down head_right_mar" id="modeuser">
<!-- <div class="toggleWrapper">
<input class="dn" type="checkbox" id="dn" value="1"/>
<label class="toggle" for="dn"><span class="toggle__handler"></span></label>
</div> -->
<div class="right_toggle">
<ul>
<li data-get="seller" class="changeusermode active">
<span>Seller</span>
<span class="nav_span">On</span>
</li>
<li class="mid_toggle">
<div class="switch">
<label>
<input class="changeusermode_btn" type="checkbox" data-on="Yes" data-off="No">
<span class="lever"></span>
</label>
</div>
</li>
<li data-get="buyer" class="buyer_border changeusermode ">
<span>Buyer</span>
<span class="nav_span">Off</span>
</li>
</ul>
</div>
</div>