How to put space between switch button and its text in android? - text

I have the following element:
<Switch
android:text="Data about client?"
android:id="#+id/connected" />
But on designer the switch button and its text "Data about client?" are very glued together. I tried putting space between ? and " like that :
android:text="Data about client? "
But I don't like that type of solution very much

I had the same issue, but for me the accepted answer of Sravan Sriram did not solve the problem.
What worked for me was the tag
android:switchPadding = "10dp"
Minimum space between the switch and caption text. docs

Sure, kindly use this
android:switchPadding="5dp"

If you are using androidx.appcompat.widget.SwitchCompat then use app:switchPadding="8dp". This is work for me

Use tag "android:thumbTextPadding"

Related

How to locate the element as per the HTML through FindElementByXPath in Selenium Basic

I'm writing a VBA code to login into a webpage and load some information i have in an excel worksheet.
I'm new in Selenium. I already got the login part right, but now i need to click in an element and i keep getting errors.
I need to click in the Company 2 button.
This is what i've got so far:
bot.FindElementByXPath("//input[#value=""Company 1""]").Click
Outputs NoSuchElementError
bot.FindElementByXPath("//input[#value=""Company 2""]").Click
Outputs ElementNotVisible
I don't know what i'm doing wrong, i think that the first input being hidden has something to do. Hope anyone can help me.
Might help you to know you can also use ByCss in most circumstances, in which case you can use:
bot.FindElementByCss("input[value='Company 1']").Click
That is nice and short.
The CSS selector is input[value='Company 1']. This says find element with input tag having attribute value with value of 'Company 1'.
XPath might be incorrect. Please try the following syntax:
FindElementByXPath("//input[#value='Company 1']")
First of all, use CSS selectors whenever possible. They are much easier to handle.
Now if you are using CSS selectors try to find the second button using something like
input[value="Company 2"]
For more info on this selector, look at https://www.w3schools.com/cssref/sel_attribute_value.asp
You can use any xpath, in first look I found your xpath is incorrect, try this:
//input[#type='button'][#value='Company 2']
//input[#type='button'&& #value='Company 2']
//input[#role='button'][#value='Company 2']
You can also use findelements() to store are all buttons and using if else you can extract the company 2 button
As per the HTML you have shared to invoke click() on the desired elements you can use the following solution:
To click on the element with text as Company 1:
bot.FindElementByXPath("//input[#class='btn_empresa ui-button ui-widget ui-state-default ui-corner-all' and #value='Company 1']").Click
To click on the element with text as Company 2:
bot.FindElementByXPath("//input[#class='btn_empresa ui-button ui-widget ui-state-default ui-corner-all' and #value='Company 2']").Click
Have you tried right-clicking the HTML in inspect and going to Copy>Copy XPath? That might give you something different. Maybe the buttons are created from Javascript and so the WebDriver can't actually see them?
Or try
Company_1 = bot.find_element_by_xpath("//input[#value='Company 1']")
Company_1.click()
Company_2 = bot.find_element_by_xpath("//input[#value='Company 2']")
Company_2.click()
And change the syntax with the ' ' quotes like someone else mentioned.

How to wrap af:inputFile text name?

I am using JDeveloper 11.1.2.3.0,
I have an inputFile component in my page that takes its text value from the name of some components. The problem is that that when the text is long it gets displayed all there and may even occupy the whole window. Is there any possibility to wrap this text value in this case?
I don't think <af:inputFile> has a labelStyle attribute:
You can try adding the CSS in the component's inlineStyle or contentStyle
<af:inputFile inlineStyle="word-wrap:break-word;" />
It depends if the very long text is in the content or the label of the field.
If this doesn't do the trick, you can try creating a custom skin and customizing the label or content style via the adf style selectors: af|inputFile::content , af|inputFile::label.
Btw, you need to check if word-wrap works on all browsers you're targeting.
You can try setting the labelStyle attribute of the <af:inputFile> component to wrap the contents of the label. I am not sure of the CSS style attribtue information for it, but searching on the net I found word-wrap:break-word;.
I too had this problem with af:inputFile.
Just give contentStyle="width:200px" it will solve the issue.
we can adjust the width accordingly.

Animating images on a xpage

I want to have a series of images slide into a section on a page. Can anyone point me to a technique of doing that?
many thanks!
clem
It sounds like you are looking for a carousel - check out these jQuery plugins
http://www.tripwiremagazine.com/2012/06/jquery-carousel.html
If you like to use Dojo that comes with XPages, check out these links:
http://davidjs.com/2011/01/fun-with-dojo-animation/
https://dojotoolkit.org/reference-guide/1.8/dojox/image/LightboxNano.html
http://ofps.oreilly.com/titles/9780596516482/animation_and_special_effects.html
http://almaer.com/blog/cleanup-of-manual-animation-via-dojo-animation
Have fun!
Check out the Dojo Effects simple actions available with 8.5.3 UP1 and extlib.
Documentation here:
http://infolib.lotus.com/resources/domino/8.5.3/doc/designer_up1/en_us/DominoDesignerXPagesExtensionLibrary.html#Simpleactions_dojoslideto

CLEditor deault text from query

I have a textarea that displays a text I get from a query. But this textarea runs the CLEditor plugin and execute the website does show the "CLEditor area" empty. How would you add default text in the plugin? For example:
<textarea id="areaEdit" name="areaEdit"><?php echo $row['myText'] ?></textarea>
I hope your help, thank you very much.
p.d. sorry for my english.
That is how you would do it. Did you confirm that the data of $row['myText'] actually is valid and has a value? Comment out the CLEditor code and see if it shows up in a basic textarea.

How to make a tab expend?

Here is the website I want to try out.
http://www.csun.edu/
Under myNorthRidge Portal, there is a place for me to fill out my user id and password. But the thing is that I have to click on the "sign" to expand the tab first. I could not find a way to get around this problem :( ? Anyone could share me a hint how to solve this problem? Thanks
This is the html tag for it:
<div class="CollapsiblePanelTab">Log In</div>
Thanks everyone, I got it solved ;) by using element_by_xpath( "..." )
ie.element_by_xpath( "/html/body/div/div[5]/div/div" ).click
This worked for me:
browser.div(:text => "Log In").click

Resources