An unknown server-side error occurred while processing the command in Safari. - selenium

Having this error while trying to set the value of the textbox to blank in Safari 10.1.
Using WebdriverIO: 4.6.2
Scenario: Got a text already in the textbox. Have to make that textbox blank to reset the search.
Code Snippet:
$(elementSelector).setValue('');
browser.waitUntil(() =>{
//Some conditions to meet after reset
});
Error:
An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 11 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'mac-185-44-130-79.browserstack.com', ip: '185.44.130.79', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.5', java.version: '1.8.0_51'
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, databaseEnabled=true, handlesAlerts=true, version=12604.1.22, cleanSession=true, platform=MAC, nativeEvents=true, locationContextEnabled=false, webStorageEnabled=true, browserName=safari, javascriptEnabled=true, platformName=macOS, cssSelectorsEnabled=true}]
Session ID: 89FDFB29-FF29-4DE0-B7D2-709AA0E86726

Related

Missing error message from Selenium after button click

I'm doing a simple form submit using the click method:
$this->url('/');
$move = $this->byName('move');
$move->click();
$content = $this->byTag('body')->text();
But I can't understand the error message I get from Selenium:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:40.131Z'
System info: host: 'olle-GA-H81M-S2H', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-51-generic', java.version: '1.8.0_141'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.EeZF7cCPXFo3, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=LINUX, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=56.0, platformVersion=4.4.0-51-generic, moz:processID=6598, browserName=firefox, javascriptEnabled=true, platformName=LINUX}]
Session ID: eae99c32-7401-4892-9190-e242b3b81f5a
I can var_dump the $move button and confirm that is no null. Any ideas?
The PHP backtrace:
vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:165
vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:175
vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php:100
tests/questions/DateTimeValidationTest.php:215
vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:371
vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:337
Edit: Above was the gecko driver. I get a similar error for the Facebook driver:
Facebook\WebDriver\Exception\UnrecognizedExceptionException:
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:40.131Z'
System info: host: 'olle-GA-H81M-S2H', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-51-generic', java.version: '1.8.0_141'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.TpTQ5MWyL1hl, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=LINUX, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=56.0, platformVersion=4.4.0-51-generic, moz:processID=9146, browserName=firefox, javascriptEnabled=true, platformName=LINUX}]
Session ID: 56036593-dc86-4132-9d0f-78beb369b35c
vendor/facebook/webdriver/lib/Exception/WebDriverException.php:158
vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:320
vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:535
vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php:81
tests/questions/FacebookDriverTest.php:42
The HTML for the button is:
<button type="submit" value="movesubmit" name="move" accesskey="l" class="ls-move-btn ls-move-submit-btn btn btn-lg btn-primary">
Submeter
</button>
Edit 2: Exception from selenium:
15:35:15.177 INFO - Executing: [find element: By.name: move])
15:35:15.193 INFO - Done: [find element: By.name: move]
1509374115699 addons.productaddons INFO downloadXHR File download. status=200
1509374115702 addons.productaddons INFO Downloaded file will be saved to /tmp/tmpaddon-e50bf4
1509374116634 DeferredSave.webext.sc.lz4 DEBUG Starting write
1509374116639 DeferredSave.webext.sc.lz4 DEBUG Write succeeded
15:35:17.196 INFO - Executing: [click: 0 [[FirefoxDriver: firefox on LINUX (32c1dfec-9af4-448f-86fa-3a41035bf6b5)] -> name: move]])
15:35:17.501 WARN - Exception thrown
org.openqa.selenium.ElementNotInteractableException:
Edit 3: Mystery solved, I had two buttons with the same name, and the first one was hidden. Hence, the exception. Solved by putting a proper ID on the element I want to interact with.

Selenium: How to click on href link when it wont have absolute path

I am trying to identify a link in the CQ5 webpage and click on it.
Below is the html code:
<a href="/siteadmin" title="Websites">
<div class="icon siteadmin">
<div class="title">Websites</div>
<div class="description">Create and manage multiple websites.
</div>
</div>
</a>
The below are method i tried to find the information and click on it.
driver.findElement(By.linkText("Websites")).click();
driver.findElement(By.xpath("//a[#href='/siteadmin']")).click();
Getting following exception:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (528, 174). Other element would receive the click: <div class="resourcebox">...</div>
(Session info: chrome=52.0.2743.116)
(Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 39 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
System info: host: 'pilapwin7020', ip: '10.116.252.187', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b), userDataDir=C:\Users\User\AppData\Local\Temp\scoped_dir44444_30971}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=52.0.2743.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 5116ba44126c39293ac466aed3d6608a
You should try using JavascriptExecutor to perform click in this case as :-
((JavascriptExecutor)driver).executeScript("arguments[0].click()", driver.findElement(By.cssSelector("a[href = '/siteadmin'][title = 'Websites']")));
You need to check if the attr contains the string, because it returns the fullpath even if in the HTML shows only /siteadmin.
XPath Solution:
//a[contains(#href, '/siteadmin') and #title='Websites']
Css Selector Solution:
a[href*='/siteadmin'][title='Websites']

protractor NoSuchElementError: no such element

When I was try to send keys in non-angular page with protractor it shows an error "NoSuchElementError: no such element"
NoSuchElementError: no such element
(Session info: chrome=47.0.2526.80)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 24 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'Sekhar-PC', ip: '192.168.1.3', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_13'
* Element info: {Using=id, value=ius-userids}
Session ID: 352e36f285f80dee03eb5c88697ebc08
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\Sekhar\AppData\Local\Temp\scoped_dir3128_18281}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=47.0.2526.80, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
**
When testing non-Angular pages with Protractor, you need to include this line in all of your specs:
browser.ignoreSynchronization = true;
You also need to wait for the page to completely load. Using ExpectedConditions is one way to do that. Example:
var EC = protractor.ExpectedConditions;
browser.wait(EC.elementToBeClickable(element(by.css('.wait-for-me'))), 10000);
Use sleep condition.
browser.driver.sleep(500);
This will wait the browser for sometime.
Looks like timing issue, write some "expect" statements so that it will verify for particular functionality is available.
Try to use implicit wait.
Try writing your script in promises so that it will wait.
field.sendKeys(value).then(function(){
submitButton.click().then(function(){
expect('xyz').toBe(xyz);
});
});

While creating a test script in selenium i am getting following error

package javaapplication3;
import java.lang.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
/**
*
* #author kipl74
*/
public class JavaApplication3 {
/**
* #param args the command line arguments
*/
static WebDriver driver = new FirefoxDriver();
public static void main(String[] args) {
// TODO code application logic here
String baseurl="www.google.com";
driver.get(baseurl);
}
}
When I run this code, I am getting following errors. How to resolve it?
Exception in thread "main" org.openqa.selenium.WebDriverException: f.QueryInterface is not a function
Command duration or timeout: 16 milliseconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'comp74', ip: '192.168.0.74', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_17'
Session ID: 0282db64-b28b-4c3b-ba83-26fe06bd46a3
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=26.0}]
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:525)
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:554)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
at javaapplication3.JavaApplication3.main(JavaApplication3.java:23)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: f.QueryInterface is not a function
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'comp74', ip: '192.168.0.74', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_17'
Driver info: driver.version: unknown
at <anonymous class>.FirefoxDriver.prototype.get(file:///C:/Users/kipl74/AppData/Local/Temp/anonymous2500892407184382634webdriver-profile/extensions/fxdriver#googlecode.com/components/driver_component.js:8720)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/kipl74/AppData/Local/Temp/anonymous2500892407184382634webdriver-profile/extensions/fxdriver#googlecode.com/components/command_processor.js:10831)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/kipl74/AppData/Local/Temp/anonymous2500892407184382634webdriver-profile/extensions/fxdriver#googlecode.com/components/command_processor.js:10836)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/kipl74/AppData/Local/Temp/anonymous2500892407184382634webdriver-profile/extensions/fxdriver#googlecode.com/components/command_processor.js:10778)
Java Result: 1
Method get requires the protocol as part of the URL.
Change:
String baseurl = "www.google.com";
To:
String baseurl = "http://www.google.com";
Please check your calling method to open the browser. I believe you have written code like this:
driver.get("Url"); //Incorrect Code
Correct should be like:
driver.get(Url);// Correct Code

Query related to Explicit wait: wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(

package wait1;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Explicit {
public static void main(String[] args) {
FirefoxDriver driver= new FirefoxDriver();
WebDriverWait wait= new WebDriverWait(driver,20 );
driver.get("http://www.91mobiles.com/");
driver.findElement(By.xpath("//*[#id='q']")).sendKeys("Micromax");
//wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[#id='ui-id-22']/span[2]")));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("id=ui-id-172")));
driver.findElement(By.xpath("//*[#id='ui-id-52']")).click();
}
}
I am getting the following error when I execute the above script:
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 20 seconds waiting for visibility of element located by By.id: id=ui-id-172
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Driver info: driver.version: unknown
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:259)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228)
at wait1.Explicit.main(Explicit.java:20)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"id=ui-id-172"}
Command duration or timeout: 21 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Session ID: fd977506-2457-4981-a304-f9a9b6b57f4e
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=17.0.7}]
at sun.reflect.GeneratedConstructorAccessor10.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: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.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:348)
at org.openqa.selenium.By$ById.findElement(By.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:522)
at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:520)
at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:130)
at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
... 1 more
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"id","selector":"id=ui-id-172"}
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Driver info: driver.version: unknown
The behavior you are getting is the expected bahavior. You specified a 20 second explicit wait and in that time the ExpectedConditions.visibilityOfElementLocated(...) could not be established. So the wait fails with a timeout.
If you want to go on in your program you need to surround the wait in a try-catch block and catch org.openqa.selenium.TimeoutException
Try using like this
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[#id='ui-id-52']"));
Make sure that whatever identification type you use while waiting should be in the statement you use for action. (e.g. click, set etc.)
Here, we have two solutions...
Try increasing your WebDriverWait time to check if it fix the issue.
Try to locate same element by firebug, if it is successfully found by firebug, than WebDriverWait time is the only culprit.
You'll always get a timeout with the code you have. This is the offending line:
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("id=ui-id-172")));
Note how you have By.id("id=ui-id-172"). This is wrong. It would look for an object that has the id id=ui-id-172. While it is possible to have an id with this value (yes, I tried and it works) it is unlikely that this is what you want, especially given your XPath expression on the next line. What you want, to be consistent with the rest of your code, is By.id("ui-id-172").