0

This is my first post so I did some research before asking this question, but it was all in vaine. I'm writing my python script for Android application and I need to use basic click() command, in order to get deeper.

Android 6.0.1 (xiaomi redmi note 3 pro), SDK installed for Android 6.0, python 3.6.1, Appium 1.0.2 + Pycharm. Element is localized with no problems, but click() doesn't work, nothing happens.

Part of my script:

driver.find_element_by_id('com.socialnmobile.dictapps.notepad.color.note:id/main_btn1').click()

I tried to use .tap() instead, but it says "AttributeError: 'WebElement' object has no attribute 'tap'".

I would be very grateful for your help, cause I'm stuck with it for good.

2 Answers 2

1

Ok, after a long fight I came up with the solution. My smartphone - Xiaomi Redmi Note 3 Pro apart from standard USB Debugging option in settings, has another USB Debugging (security option). It has to be enabled as well, cause the second option protects smartphone from remote moves. Regards.

Sign up to request clarification or add additional context in comments.

Comments

0

Try this

driver.find_element_by_id('main_btn1').click()

Find the ID mentioned under the resource id in case you are using appium version less than 1.0.2

You are pasting the whole package id com.socialnmobile.dictapps.notepad.color.note:id/main_btn1 which appium wont detect because that is certainly not the element id.

In case this doesnt work, please let me know the contents you see in the inspector.

11 Comments

Unfortunately it didn't help. The button is localised both ways (with short or long atributte in id) and it gives "Process finished with exit code 0" in both ways. It doesn't say that it can not localise the item. But it desn't want to click it..
Can you paste the contents of what is displayed in the inspector
In ruby i usually write it this way find_element(id: 'main_btn1).click`
Ok. Line 13 in script: driver.find_element_by_id('main_btn1').click() Line 14 in script: driver.find_element_by_id('text').click(). The inspector says: "File "C:/Users/Kwasik/Desktop/colornote_test1_KRZ.py", line 14, in <module> driver.find_element_by_id('text').click()" selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters. So, line 13 goes okey, but 14 can not go good, because there was no click and as a result there is no item from line 14.
Is "text" the id? and why is it added in double quotes? what is the id of the element you are asserting in line 14
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.