i have a button, upon clicking it will change the display of a div from none to block. I wanted to click on the button, have the div displayed as 'block', click "Done" and then the div's display become 'none'. Capybara was able to click on the 1st button but it couldn't seem to find the 2nd button "Done". I tried several ways:
click_on("Done")
find_button("Done").trigger('click')
find_button("Done").trigger('click')
find_link("Done").trigger('click')
I even tried to use javascript:
page.execute_script("document.getElementById('button_done').click()")
but nothing happens. I printed out the display property of the pop-up div prior to the clicking "Done" and after the clicking to check if the button was click but both statements gave me the div's property as 'block' (expected 'block' before clicking "Done" and changed to "none" after the clicking).
I allowed it to sleep(10) but doesn't seem to help.
I used the same javascript on the page console and it worked as it should be.
Any inputs?
Thanks
EDIT:
feature:
Given I click on "Create an item"
And I chose an option
Then I should be able to create an item
steps:
step "I chose an option" do
within ('#web') do
click_on "On"
end
sleep 3
#Here is where the div gets displayed with the 'Done' button
find('#button_done').click #(doesn't work though)
sleep 3
click('Create')
end
try find('selector', :visible=>false)
Related
I'm using Ranorex (v10.1.6) for a Desktop Application written mostly in C#. On a Form there is a table with rows and cells. When clicking on a date cell, it should reveal a button to open the calendar. Therefore I require first a click on the table cell which should make the calendar button visible, after which I then can click the calendar button.
Problem: The click() event does not make the button visible. It seems that the click event does for a fraction of a second make the calendar button visible, but then it disappears again.
It seems that the click event does after the click something different which hides the calendar button again. I also tried to accomplish the same with the Mouse Click, and Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left) followed by Mouse.ButtonUp(System.Windows.Forms.MouseButtons.Left), but this didn't work either.
Anything else I could try to get this to work?
I am trying to scrap a web page that requires a click in order to display a phone number (https://homestars.com/on/toronto/electricians?page=1).
I can access and click on the 1st button using
browser.button(class: "company-search-contact__button").click
But I can't acess the following ones given that they all have the same tag.
I have not found any variations of the button() method that can be more specific.
The expression you are using would only click on first button. You need to select all buttons and click them one by one
page = Nokogiri::HTML(open("https://homestars.com/on/toronto/electricians?page=1"))
buttons = page.css('button.company-search-contact__button') #select all buttons on the page
buttons.each do |button| # for each button
button.click #click on the button
end
I was trying to simulate "tap to show/hide the fixed toolbar" when I found out that it's already the default function hahaha!
By default works charmly: it starts "show" and when it taps then "hide" and when taps again "shows" etc. PERFECT!
The problem is that I want it to start hidden and when the user taps shows and so on...
I used
$(".divBotoneraSimple").hide();
but then it doesn't show when tapped! I also tried:
$.mobile.fixedToolbars.hide(true);
$("[data-position='fixed']").fixedtoolbar('hide');
but both of them "stop my App" when triggered!
In order words I need to trigger those hides from javascript and still respond to tapping!
Use .toolbar() method with show, hide or toggle.
$(".ui-header, .ui-footer").toolbar("toggle");
Note that if you are at the top of the page, the header won't be hidden, only the footer, and vice versa.
I would like to create a rails drop down menu, with two options: "Upload file" and "Write text". When "Upload file" is selected, an upload form will appear on the right hand site. When "Write text" is selected, an text area appears instead.
Thanks a lot!
Well there are many ways you could go about this, but I would just display the view as normal (but hide one of the elements to begin with) and attach a jquery event to the drop down menu. You can then show/hide the element within the event handler based on the value selected. Take a look at http://api.jquery.com/change/, http://api.jquery.com/hide/ and http://api.jquery.com/show/ to get started.
In SP Designer, How do I change the default text in the button. Like OK--Submit and Cancel--Go Back.
Can I change it, If yes what where does the mapping goes ..
Thank you..
You can change the text of Buttons in case of custom List Form
Right Click on OK Button select proporties
Select Indesgin as True
Change the Text to Submit
Repeat above steps for Cancel button as well