Open NadeemBader opened 4 years ago
if you are using python or java you can use driver self.driver.find_element_by_image()
I'm using c#. Is that possible?
No.
Ok - I understand. In general, is that mean that using WinAppDriver with Python is more powerful than using it with c#?
Depends on what do you want to achieve, so far this is the only difference what I have observed in different language bindings
Ok - thank you very much
Hi again - I'm trying to implement the "find_element_by_image" method using Python as shown below:
from appium import webdriver
desired_caps = {}
desired_caps["app"] = "Root"
driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', desired_capabilities=desired_caps)
element = driver.find_element_by_image("D:\\Form.png")
print("element", element)
print("rect: ", element.rect)
print("center_x: ", element.center_x, "center_y", element.center_y)
size = self.driver.get_window_size()
print(size)
But I get the following error message: "Message: Invalid selector: -image". Any idea? What is wrong in my code?
It is appreciated to get some help here. I even tried the following code, but not working too:
file = open("D:\\Form.png", "rb");
content = base64.b64encode(file.read());
time.sleep(3)
element = driver.find_element_by_image(content)
Seems like a bad syntax of image path. Am I wrong?
This will not work with WinAppDriver server, please download the appium desktop, it works with that only,
I am also facing the same issue. Please find the below line I have tried to click on the image. _driver.FindElementByImage(imagePath).Click();
Note: First two executions I was able to click using above line of the code, do not have idea from 3rd exection onwords It was throwing the below mentioned exception. e = {"Invalid selector: -image"}
Hi
I'm able to located an item in my application which actually contains an image with texts (Located in different corners). I'm unable to access that texts (even not located by inspect.exe tool). Is that possible to extract that texts and the location of each text??
Best Regards, Nadeem Bader