I am using Sikuli and for first time I am stuck and need some "light".
I have a div which contains the user profile image, is impossible to visual recognise this with sikuli since the image is changing. Also I have no other element around that can help me get that element.
I need somehow to get that element by the id and I cannot find any info if such a method exist in Sikuli.
Why you are using sikuli to automate web in first place?
For that, selenium do the job better. Or if you like, a more high level framework: Robotframework/Cucumber/Lettuce with selenium library.
If you really want use sikuli you can try this:
Give it a picture on the side of avatar with a offset.
Example:
GUI: User Xpto [AVATAR] Logout
You can take a picture from logout and give offset to move it:
Example not tested: Click [USER] 50 #move right on the x coordinate
Example not tested: Click [LOGOUT] -10 #move left on the x coordinate
Sikuli is visual automation tool, works only with images or text found on images (SikuliX). So it does not accept xpath/id etc attributes of elements in a web-page. however if you want to use them please use Selenium Webdriver or Selenium extension with SikuliX.
You might want to explore Sikuli-WebDriver. SikuliFirefoxDriver extends Selenium's FirefoxDriver and you can search by id etc. Read more about Sikuli-WebDriver here.
For automating web pages, it is better to use selenium webdriver rather than sikuli.
In webdriver, we can find element by id.
sikuli purely works on visible image, it cannot find any element by its html attributes.
Related
I'm about to finish developing an automated program on Python and the only thing that's stopping me it's a web element that gets immediately hidden when I try to inspect it from an OpenSea page (can't share the link here since it requires to be connected to my wallet):
So far, I have only managed to get the XPATH and the CSS_SELECTOR of this problematic element (div#tippy-298) which is the following:
button_problematic_xpath = driver.find_element(By.XPATH, '//*[#id="tippy-298"]')
button_problematic_css = driver.find_element(By.CSS_SELECTOR, '#tippy-298')
But what I need is to get the XPATH or CSS_SELECTOR of the Web Elements that button_problematic_css contains, more specifically the "Starting" and "Ending" Textboxes :
Also, just in case, the element that's on top of button_problematic_css is called "Duration", here's its XPATH:
button_duration = driver.find_element(By.XPATH, '//*[#id="duration"]').click #after clicked it deploys div#tippy-298 element
I was wondering if there could be any method to force the visibility of this button_problematic_css using the Chrome Console in the Inspection of Web Elements, or by using an specific method from Selenium on Python3.x to inmediately download all of the web elements this page has right after button_problematic_css is visible.
What I have tried so far is to manually inspect the element, by pressing Ctrl + Shift + C and and then clicking the elements contained in button_problematic_css which just ends up hiding this element before even clicking its content, the same happens when trying to display the contents of this element in the DOM of this page, it just dissapears.
I just wish my program could be capable of editing the dates in the "Starting" and "Ending" Textboxes
I guess you need to click the button to show the element. why did I guess? you need to show the url
or u can also try this code:
clickmore=WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, 'blabalabla')))
self.driver.execute_script("arguments[0].click();", clickmore)
button_duration = driver.find_element(By.XPATH, '//*[#id="duration"]').click()
After several days of working, I managed to solve this, it happened that in order to get the XPATH from these particular elements, I had to use the Chrome Console and type $('#duration').click();.
In this case, #duration is a Selector that can be used to get the web element button that allows you to edit the period of time you want to set when clicked.
I guess the general statement would be something like this:
$('#your_css_selector').click();
Now, this way I could managed to look deeper in the DOM without making them hide again.
I am experimenting with web-crawling techniques with python and selenium webdriver in win10 and firefox.
I encountered the following typical page with a pop-up box asking for consent to allowing for cookies.
https://irs.thsrc.com.tw/IMINT/
There are only the following two clickable tags in the page with the following xpaths.
//html/body/div[2]/form[1]/div[2]/div[1]/div[1]/div[1]/div[1]/span[1]/a[1]
//html/body/div[2]/form[1]/div[2]/div[1]/div[1]/div[2]/table[1]/tr[1]/td[1]/input[1]
People here suggested that I can first get an element via webdriver and then use the two methods of is_enabled() and is_displayed() to together check if the element is clickable.
However, when I get elements with the following statement:
e = WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, xpath)))
I found that all elements (even those in the shadow) that I got via the above statement are both enabled and displayed.
But in fact in the browser, only the two actionable elements in the pop-up message box were clickable.
All the other elements were in the shadow and cannot be clicked (or actionable).
Can someone tell me how to get the correct information which elements are actually actionable via some API ?
Thank you very much.
Farn
I am working on automation test-case through selenium web-driver. I am stuck at one place where I am always getting first chrome'd default pop up. I am not able to do anything with that pop up as it's not inspecting in code, Please check in attached screen shot for default pop-up.
Please suggest me to handle these thing. Any help is appreciated.
These are Window based pop up, which is not controlled by selenium so need to use java.awt.Robot class or Autoit tool.
Robot class describe as-
for example:
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
robot.delay(10000);
it takes one key at a time, we can not pass multiple keys at one time.
Hope this will solve your problem.
I am recording a .Net application using Selenium IDE. Theres this scenario, that a textbox is presnt. I need to enter a name to search. As soon as i start typing, matching options come in a dropdown below. I have to select one of them, then the application goes to the next page.
The problem is, Selenium doesnt record this selection from the drop down. More over, when the script is typing in the name, the dropdown list is not being visible at all.. i.e. the ajax call is not occuring.
Please help. I need the solution code in Selenese or HTML, since I'm not much of a coder myself, and also, I am simply recording and playback, so I am not using Java or other scripts.
This question is great,
and so is the answer in this blog: http://blog.buberel.org/2010/07/howto-test-jquery-ajax-autocomplete-menus-with-selenium.html
other option to deal with this problem is to use a different way to insert your text into the text box, as described here: Can selenium handle autocomplete?
I am working on getting only a part of the navigated webpage.
for example, "the face book . com" homepage.
I only want the division of groups on the left to appear in my web Browser control.
is that possible?
I am having ideas on fetching but i don't know how to do it. any other way is fine.
also, please let me know where to put the code, because i am new on vb.net
web.Document.All("mConnect").InvokeMember("click")
this is for clicking something inside the html
web.Document.getElementId("<div>").InnerHtml("")
is this code correct? what is it for?
let's say we cut the google homepage 4 ways. and i only want Quadrant 2 to appear in my webBrowser control. is that possible? I think this is a clearer explanation..
I saw one post in this forum that technically solved my problem by manually forcing the webbrowser control to scroll to what place I want.
Web.Navigate("javascript:window.scroll(320,10,document.body.scrollHeight);")
320 is the width, 10 is the height. edit to where you want it to be.
adjust the size of your webBrowser then you can particularly choose the part that you want to see, disable scrollbars if you want.