Reputation: 331
I am using XPath, HtmlUnitDriver & FirefoxDriver.
Here is the my xpath to click on the signin button. When I use XPath
//div[@id='mainPane']/form/table/tbody/tr[10]/td/a[2]
to click on sign in button then it is working fine with FirefoxDriver but not working in HtmlUnitDriver.I have also enabled & disabled the javascript in HtmlUnitDriver.But not working.
I am getting Error:- When I click on this sign in button using HtmlUnitDriver,then it is not redirecting to next page,but in FirefoxDriver,it is redirecting to next page.Here is my code:-
HtmlUnitDriver driver = new HtmlUnitDriver(false);
WebElement webElement = webDriver.findElement(By.xpath("//div[@id='mainPane']/form/table/tbody/tr[10]/td/a[2]"));
webElement.click();
Please guide me.
Upvotes: 1
Views: 1699
Reputation: 1224
As @David Grant suggests your problem might be related to the Javascript. Enable your javascript in the HtmlUnitDrive -
HtmlUnitDriver driver = new HtmlUnitDriver(true);
Upvotes: 1