Dropdown selection automation using selenium - selenium

I need to automate the selection for a drop down box in selenium. The html code which comprises the dropdown is given below. The html code for each component is taken using firebug.
// Input Area
<input type="text" title="Filter by Administrator" readonly="readonly" value="Filter by Administrator" id="dnn_ctr373_View_BusinessList_admin_dd_Input" class="rcbInput rcbEmptyMessage" name="dnn$ctr373$View$BusinessList_admin_dd" autocomplete="off">
// Dropdown arrow
<a style="overflow: hidden;display: block;position: relative;outline: none;" id="dnn_ctr373_View_BusinessList_admin_dd_Arrow">select</a>
// Values inside drop down
<ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;">
<li class="rcbItem ">All</li>
<li class="rcbItem ">dat#nykkos.com</li>
<li class="rcbHovered ">dat1#nykkos.com</li>
</ul>
I use the following code for automating the dropdown selection, based on the reply from here.
Select select = new Select(driver.findElement(By.xpath("//*[#id=\"dnn_ctr373_View_BusinessList_admin_dd_Input\"]")));
select.deselectAll();
select.selectByVisibleText("All");
The code gives me the following exception:
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:18'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.35-32-generic', java.version: '1.6.0_26'
Driver info: driver.version: unknown
at org.openqa.selenium.support.ui.Select.<init>(Select.java:46)
at FilterByAdministrator.testFilterByAdministrator(FilterByAdministrator.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I am not sure, whether the code I used above for dropdown selection is correct or not.
Can someone please let me know the possible solution for the same.

Try this:
driver.findElement(By.xpath("//*[text()='select']")).click();
driver.findElement(By.xpath("//*[text()='All']")).click();
It might work. As per your html it's not looking like a select box. You may achieve it with normal click operations.

Use:
driver.findElement(By.id("dnn_ctr373_View_BusinessList_admin_dd_Input"));
Instead of:
driver.findElement(By.xpath("//*[#id=\"dnn_ctr373_View_BusinessList_admin_dd_Input\"]")));
EDIT
Try the below code and let me know if it is working.
WebElement DropDown = driver.findElement(By.id("dnn_ctr373_View_BusinessList_admin_dd_Input"));
Dropdown.sendKeys("All");

If you read the error message it says -
Element should have been "select" but was "input"
Which indicates that the web element in question is an input field type.
So instead of selecting, try typing/send your input, like so
driver.findElement(By.id("dnn_ctr373_View_BusinessList_admin_dd_Input")).sendKeys("All");

In python webdriver dropdown selection is very easiest way. See the below code.
Select(driver.find_element_by_xpath("xpath")).select_by_visible_text(" enter text with you want select")
It should be work in python selenium webdriver.

Above lines with case sensitive touchup
Driver.Instance.FindElement(By.XPath("//*[text()='select']")).Click();
Driver.Instance.FindElement(By.XPath("//*[text()='All']")).Click();

Related

ElementNotVisibleException due to multiple input elements

I have a geb-cucumber scenario which in some point tries to insert a string in an input field of a Frame.
The problem is that the frame has many identical inputs (!!) for some reason and looks something like
<input aria-labeledby="userid-label" aria-required="true" autocomplete="off" class="error input" tabindex="51" type="text" id="el3fd4c7bd50db061c" maxlength="48" aria-invalid="true" aria-describedby="gwt-uid-63">
<input aria-labeledby="userid-label" aria-required="true" autocomplete="off" class="error input" tabindex="51" type="text" id="el3fd4c7bd50db061c" maxlength="48" aria-invalid="true" aria-describedby="gwt-uid-63">
<input aria-labeledby="userid-label" aria-required="true" autocomplete="off" class="error input" tabindex="51" type="text" id="el3fd4c7bd50db061c" maxlength="48" aria-invalid="true" aria-describedby="gwt-uid-63">
In the Chrome devtools console if I give $("input[name=xxx]) it returns the elem and then keep throwing the following message
VM5451:1 Uncaught SyntaxError: Unexpected token # in JSON at position 0
at JSON.parse (<anonymous>)
at i (application-2a3801d….js:11)
this might be irrelevant as my purpose is to just get the element and insert a string into.
getArrayField(userIdField) << "aabbcc"
The getArrayField seems to try to workaround that but it doesnt really work.
The test fails with the following stacktrace
org.openqa.selenium.ElementNotVisibleException: element not visible
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.11.12-200.fc25.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z'
System info: host: 'iob-4finance', ip: '192.168.175.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.11.12-200.fc25.x86_64', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5), userDataDir=/tmp/.org.chromium.Chromium.2ksxEt}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.113, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 85a17386757827e393d4f83772a88959
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:82)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:275)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:99)
at geb.navigator.NonEmptyNavigator$_leftShift_closure30.doCall(NonEmptyNavigator.groovy:448)
at geb.navigator.NonEmptyNavigator.leftShift(NonEmptyNavigator.groovy:447)
at geb.content.TemplateDerivedPageContent.leftShift(TemplateDerivedPageContent.groovy:27)
at com.ofg.loans.dk.at.web.site.pages.IdentificationPage.logIntoNemIdApp(IdentificationPage.groovy:40)
at com.ofg.loans.dk.at.web.site.pages.IdentificationPage$logIntoNemIdApp.call(Unknown Source)
at com.ofg.loans.dk.at.web.site.stepdefs.nemid.NemIdStepDefs$_run_closure3.doCall(NemIdStepDefs.groovy:47)
at ✽.And user logs into NemId from the webapp(com/at/web/features/.feature:13)
You can also reproduce the problem at https://service.nemid.nu/dk-en/#log_on_to_self-service which is the identification service used. I could use any help or direction to the proper solution. thanks
I don't see a name field in your sample HTML. But if there is a name field, try using this in the Chrome developer tools:
$("input[name='xxx']")
And this in Geb:
$("input", name: "xxx")
Also, it seems you might be using a # as part of the name. Make sure to escape the character with \#
Another option is if the elements are always in the same order, you can use the eq selector:
$("input[name='xxx']").eq(0)

Invalid Xpath expression

My Html is like:
<pre>
<ul class="dropdown-menu dropdown-triangle-bottom-right">
<li class="post-save-publish">
Publish Now
</li>
<li class="post-save-draft active">
Save Draft
</li>
<li class="divider delete"/>
<li class="delete">
Delete Post
</li>
</ul>
</pre>
Code for handling Publish Now button:
WebElement t=driver.findElement(By.xpath("//*[#href='#' AND text()='Publish Now']"))
I am getting error :
1494681211957 geckodriver INFO Listening on 127.0.0.1:44241
1494681212176 mozprofile::profile INFO Using profile path /var/folders/dg/glyvppvs1dn31sqrrgt7yhjc0000gn/T/rust_mozprofile.4mJ76F47MPkl
1494681212177 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args []
1494681212181 geckodriver::marionette INFO Connecting to Marionette on localhost:60723
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
1494681212732 Marionette INFO Listening on port 60723
May 13, 2017 6:43:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript warning: http://localhost:2368/ghost/vendor.js?v=115d872ce7, line 2753: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
Exception in thread "main" org.openqa.selenium.InvalidSelectorException: Given xpath expression "//*[#href='#' AND text()='Publish Now']" is invalid
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'Javeds-MacBook-Pro.local', ip: 'fd50:1d9:9d9b:eb00:6d64:a5da:2f9c:7790', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, appBuildId=20160623154057, version=47.0.1, platform=MAC, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, browserVersion=47.0.1, platformVersion=16.5.0, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Darwin, device=desktop}]
Session ID: 440c0fbb-62f8-ec43-9965-b3a154425a21
*** Element info: {Using=xpath, value=//*[#href='#' AND text()='Publish Now']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:99)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:43)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:371)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:476)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at TestingBlogWebsite.AdminWebsite.main(AdminWebsite.java:313)
You get error because you should use XPath operators in lower case as
"//*[#href='#' and text()='Publish Now']"
Try
//*[#href='#' and .='Publish Now']
or
//*[#href='#' and contains(text(), 'Publish Now')]

Selenium WebDriver: Unable to Select Element

<input type="text" id="mobile" name="mobile" placeholder="Mobile Number" maxlength="10" value="" onkeyup="javascript:dispLocMob(this);" onkeydown="javascript:dispLocMob(this);" onchange="javascript:dispLocMob(this);">
Shown above is the element that I'm trying to send keys. I tried by xpath and id and all sorts of selectors, but it throws an error that is shown below:
Unable to locate element: {"method":"xpath","selector":"/html/body/div[3]/div/form/div[2]/div[1]/input"}
Command duration or timeout: 338 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'ClaimsCM8', ip: '192.168.110.118', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_51'
*** Element info: {Using=xpath, value=/html/body/div[3]/div/form/div[2]/div[1]/input}
Session ID: ec543fff-7116-4880-8c98-7c60a1c697d0
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=45.0.2}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at Selenium.Test2.main(Test2.java:62)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"/html/body/div[3]/div/form/div[2]/div[1]/input"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'ClaimsCM8', ip: '192.168.110.118', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_51'
Driver info: driver.version: unknown
at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/EFERNA~1/AppData/Local/Temp/anonymous4369679942726534324webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js:10770)
at <anonymous class>.FirefoxDriver.prototype.findElement(file:///C:/Users/EFERNA~1/AppData/Local/Temp/anonymous4369679942726534324webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js:10779)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/EFERNA~1/AppData/Local/Temp/anonymous4369679942726534324webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:12661)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/EFERNA~1/AppData/Local/Temp/anonymous4369679942726534324webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:12666)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/EFERNA~1/AppData/Local/Temp/anonymous4369679942726534324webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:12608)
Is there something defined in the Web Element that does not let me access the element in my Selenium script?
Any suggestions/advice will be highly appreciated.
Thanks you!
Try as below :-
WebDriverWait wait = new WebDriverWait(driver, 10);
el = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("mobile")));
el.sendKeys("your value");
Note :- Be ensure before finding element that it is not inside any frame or iframe. If it is inside any frame or iframe you need to switch that frame first as :- driver.switchTo().frame("frame name or id")
Hope it will help you...:)
First of all, If you are using xpaths then use relative xpath instead of absolute as slight change in DOM makes absolute xpaths invalid or refer to a wrong element.
Second try using .click(); before .sendkeys();. So your code can be something like
WebElement ele = dvr.findElement(By.id("mobile"));
ele.click();
ele.sendKeys("your string");
Lastly, make sure you do not have any duplicate elements on the page with same property, i.e. id=="mobile". Hope this helps
Please try below code:
If the element is not in any frame:
driver.findElement(By.id("mobile")).sendKeys("");
If the element is inside a frame:
// Switching to the frame
driver.switchTo().frame(<framename>);
driver.findElement(By.id("mobile")).sendKeys("");
driver.switchTo().defaultContent();
Also, please add some wait after launching the page and entering the text. And even if the code is not working, please check whether the element is visible or not using below code:
if(driver.findElement(By.id("mobile")).isDisplayed()) {
// Add the code given above
}
Hope this helps

Selenium Webdriver | Unable to locate 'href' element

I am trying to locate below link in Selenium Webdriver using Xpath and CSS.
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<tr>
<td class="cspbItmA">
<a class="cspbItm" target="_parent" href="../isp_track.asp?PARENT_MENU=Customer Order">Find Order</a>
</td>
</tr>
But neither of these options, I am unable to run the script and trapped with below exception:
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[#id='cspbGrp0']/table/tbody/tr[2]/td/a")) .click();
Starting ChromeDriver (v2.9.248315) on port 8139 Exception in thread
"main" org.openqa.selenium.NoSuchElementException: no such element
(Session info: chrome=40.0.2214.115) (Driver info:
chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86) (WARNING: The
server did not provide any stacktrace information) Command duration or
timeout: 5.06 seconds For documentation on this error, please visit:
http://seleniumhq.org/exceptions/no_such_element.html Build info:
version: '2.42.0', revision:
'5e824302019c86eae9c8c3ca9155e7307b410cf8', time: '2014-05-24
09:48:41' System info: host: 'inl-279930-1', ip: '10.13.174.254',
os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.7.0_55' Session ID: 04489825ed0cfc399afa1ffccb838870 Driver info:
org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP,
acceptSslCerts=true, javascriptEnabled=true, browserName=chrome,
chrome={userDataDir=C:\Users\SUBRAM~1\AppData\Local\Temp\scoped_dir11808_15574},
rotatable=false, locationContextEnabled=true, version=40.0.2214.115,
takesHeapSnapshot=true, cssSelectorsEnabled=true,
databaseEnabled=false, handlesAlerts=true,
browserConnectionEnabled=false, nativeEvents=true,
webStorageEnabled=true, applicationCacheEnabled=false,
takesScreenshot=true}] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:596)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:349)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:446)
at org.openqa.selenium.By$ByXPath.findElement(By.java:357) at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:341)
at roll_forward_test.cpe_progression.main(cpe_progression.java:147)
Could you help me to get this fixed, please.
My preference would be to use css over xpath and I would usually write my own selectors. Because it's in a table it can be a little tricky (meaning you may have to traverse from further up) but from the information on screen I'd go for something like:
//by href
driver.findElement(By.cssSelector("a[href='../isp_track.asp?PARENT_MENU=Customer Order']"))
OR
//by class
driver.findElement(By.cssSelector("a.cspbItm"))
Issue identified and it is caused due to the element present inside an iFrame.
When switching to iFrame first, now able to locate the element.
Thank You,
Praveen

Selenium Webdriver - IEDriver - Stuck at "This is the initial start page for the WebDriver server."

I am working on Webdriver to automate my testcase for Internet explorer 10. It was working fine until this morning, it can no longer get pass "This is the initial start page for the WebDriver server."
I am running IEDriverServer version 2.35.0 on IE10, enabled protected mode and zoom size 100%
Tried with firefox and it worked
Do any one of you have any idea what is wrong? it was fine last week and i came in this morning the IEdriver decide to die on me.
Basically it bypassed my driver.get and when straight to my action script and since its stuck at the "This is the initial start page for the WebDriver server." page, it cant really find that element. my exception,
org.openqa.selenium.ElementNotVisibleException: Element is not displayed (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 67 milliseconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_35'
Session ID: f57d0009-b2e8-412a-aee8-0b22be041e88
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, enablePersistentHover=true, ignoreZoomSetting=false, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=10, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false, [initialBrowserUrl=http://myhost:13703/], handlesAlerts=true, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
at tcm_smoke.ViewFacilityRiskReport.testFacilityRiskReport(ViewFacilityRiskReport.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)