How to make a tab expend? - watir

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

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 put space between switch button and its text in android?

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"

xpages tag cloud: links are missing

I'm tryng to use the tag cloud control from Ext.Library 9.0.1 (20160428). The cloud is generated with the correct values form the category view but all the links are missing.
I suspect I'm missing something stupid and my question will look a little bit silly but... I've already lost some hours on this without getting any result.
This is the code for the tagcloud:
<xe:tagCloud id="tagCloud1" sliderVisible="true">
<xe:this.cloudData>
<xe:dominoViewCloudData categoryColumn="0" viewName="indice"LinkTargetPage="/risultati.xsp" linkRequestParam="nometag">
</xe:dominoViewCloudData>
</xe:this.cloudData>
</xe:tagCloud>
This is what I get in a browser (just an example, all the lines look similar):
<li style="display:inline">
<a role="link" title="11 Entries" class="tagCloudSize9">Miscellaneous</a>
</li>
As you can see there is no link to anything, so the user can't click the cloud label.
Any advice will be appreciated
Thanks in advance
It seems it was only a cache-related trouble. I've restarted my server and it started to work as expected.
Just wondering why and how to avoid in the future...

What does this "button" in gmail do?

I cannot get the use of this button in the gmail sign in page , does it specify anything ?
I didnt see the usage of this also.
<div class="goog-flat-menu-button-dropdown"></div>
There is no action related this code. Maybe someone forgot it.

Can I use .htaccess for redirects?

I am using coppermine gallery, the only suggestion so far, on their help forum, was to inquire with stackoverflow. Problem - when you click on one of the Categories on main page It goes to "No image to Display". I would like it to go to something like "You must be logged in to view these pages" or something like that. The coppermine forum suggested maybe redirects in an .htaccess file? Is that the best way? I think the easiest way to explain is this: When you Click on Coudy here:http://stalag13000.net/Gallery/index.php it goes to "No image to display" but I would like it to at least go to here:http://stalag13000.net/Gallery/login.php?referer=index.php%3Fcat%3D2
I did see some posts on .htaccess but I am far from knowing if any of that could or would apply to my scenario,
Thanks for any help or direction,
yamiacaveman
If you are going to display info only to people who are logged in, you would check in the
$_ SESSION
variable to see if they are logged in or not. If they are not, you would then direct them with php to the login page.
header('Location: /login.php');
header location with php
I like Ollie Ford's suggestion. You could open a modal over the current screen, ask for them to login there and then, on success, you could thank them, close the modal, and show the content on the page.

Resources