Element not allowed: enforce-valid-basic-auth-credentials#http://xmlns.oracle.com - weblogic-10.x

Element not allowed: enforce-valid-basic-auth-credentials#http://xmlns.oracle.com/weblogic/domain in element security-configuration#http://xmlns.oracle.com/weblogic/domain>
Solutions :
enforce-valid-basic-auth-credentials followed by
<cross-domain-security-enabled>false</cross-domain-security-enabled>
Adding this tag error will be resolve

Related

I'm trying to get the "id" of an html tag, but the xpath doesnt work

I'm using selenium and i want to get the "id" of an html tag with "find_elements_by_xpath", but i've got this error :
selenium.common.exceptions.InvalidSelectorException: Message: invalid
selector: The result of the xpath expression
"//body[contains(#class,'de')]/div/div[contains(#class,'container-fluid
default')]/section[contains(#id,'mainContent')]/div[contains(#class,'row-fluid')]/div[contains(#id,'contentContainer
row-fluid')]/div[contains(#class,'content')]/div[contains(#class,'ses')]/ul/li/#id"
is: [object Attr]. It should be an element.
When i executed this code:
browser.find_elements_by_xpath("//body[contains(#class,'de')]/div/div[contains(#class,'container-fluid default')]/section[contains(#id,'mainContent')]/div[contains(#class,'row-fluid')]/div[contains(#id,'contentContainer row-fluid')]/div[contains(#class,'content')]/div[contains(#class,'ses')]/ul/li/#id")
While the same code without "/#id" work perfectly but i've got only the text in the "li" tag and it's not what i want.
According to the error, the problem comes from the Xpath.
I expected that this code would return all the "id" that are in "li" html tag, but i got the error.
Thank you for your help
#id is an attribute, not an element. The XPath is OK, but the function only returns elements, not attributes. I doubt there's find_attributes_by_xpath, but if you want to find the li element that has the #id defined, you can specify that in the quantifier:
browser.find_elements_by_xpath("//body[contains(#class,'de')]
/div/div[contains(#class,'container-fluid default')]
/section[contains(#id,'mainContent')]
/div[contains(#class,'row-fluid')]
/div[contains(#id,'contentContainer row-fluid')]
/div[contains(#class,'content')]
/div[contains(#class,'ses')]/ul/li[#id]")
~~~~~
You can then call element.get_attribute('id') to retrieve the id of the element.

InvalidSelectorException while trying to identify web element in robot framework

ign-In | FAIL |
InvalidSelectorException: Message: The given selector xpath=//*[#id='user_email'] is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: Unable to locate an element with the xpath expression xpath=//*[#id='user_email'] because of the following error:
TypeError: The expression cannot be converted to return the specified type.
Stacktrace:
at FirefoxDriver.annotateInvalidSelectorError_ (file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:10633)
at FirefoxDriver.prototype.findElementsInternal_ (file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:10691)
at FirefoxDriver.prototype.findElements (file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/driver-component.js:10695)
at DelayedCommand.prototype.executeInternal_/h (file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/command-processor.js:12534)
at DelayedCommand.prototype.executeInternal_ (file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/command-processor.js:12539)
at DelayedCommand.prototype.execute/< (file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver#googlecode.com/components/command-processor.js:12481)
This part of the error message explained why :
The given selector xpath=//*[#id='user_email'] is either invalid or does not result in a WebElement.
In this case, //*[#id='user_email'] is valid XPath expression, so it must be no element matched by that XPath. That's all I can tell from the information provided.

Can't compare expected result for <nobr> tag

There is a nobr tag with some text:
<nobr>+380</nobr>
I have described it in page-object:
elements(:txtCode, :nobr, :xpath => "//td[#id='phone_prefix']/nobr")
I need to check its value and I use following expectation:
expect(page.txtCode.text).to eql('+380')
But I'm getting the following error:
undefined method `txtCode' for #<Page:0x3071d30>
How do i describe this nobr element to bring the expect() to work?
You're defining an element collection instead of an element because you're using elements instead of element. The only method that creates on your page object is txtCode_elements. Use element instead.
element(:txtCode, :nobr, :xpath => "//td[#id='phone_prefix']/nobr")
You can read more about element collections from this blog post by Justin Ko: https://jkotests.wordpress.com/2013/06/24/defining-element-collections-using-the-page-objects-gem/

How to get element by attribute name which ends with defined word

In my XML I have elements
<driverConfig name="ADriver">
...
</driverConfig>
<driverConfig name="BDriver">
...
</driverConfig>
Is there a way how to select all value of sub-element. Problem is I can modify just first name in this expression which I already tried but with no success:
//driverConfig[#name="*Driver"]/fd:properties/fd:property[#name="path"]
With XPath 2.0 you can do //driverConfig[ends-with(#name, 'Driver')]/fd:properties/fd:property[#name="path"] respectively //driverConfig[matches(#name, 'Driver$')]/fd:properties/fd:property[#name="path"].
With XPath 1.0 you can use //driverConfig[substring(#name, string-length(#name) - 5) = 'Driver']/fd:properties/fd:property[#name="path"].

Access elements by index in an FTL Template

Need to access 1st and 2nd element of a list in the template.
My Java code:
myMap.put("key", Arrays.asList("val1", "val2");
My FTL Template:
<#list myMap?keys as key>
${myMap[key][0]}, ${myMap[key][1]}
<-- the line above fails with undefined expression on myMap[key][0]. I checked and myMap[key] is a SimpleSequence. Also, tried ${myMap[key]?first} and that failed with the same error. Any ideas?
[0] and [1] are fine for this, but it looks like that either the sequence has 0 elements, or those elements are null. What does ${myMap[key]?size} print? BTW, you can write ${myMap[key][0]!'some default'} if you want to get a value even if the item is non-existant or null.
Your problem is that you put the List into your 'myMap' object with the key: "key" then try and access it with they key: "keys".
This is why you were getting an undefined expression, to correct it:
<#list myMap?key as k>
${myMap[k][0]}, ${myMap[k][1]}
or of course you could change your java code to
myMap.put("keys", Arrays.asList("val1", "val2");
and use the ftl code as is.

Resources