Python Forum

Full Version: selenium problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, guys,

I would like to automate a process with selenium on the trading platform https://app.stormgain.com. You should fill out the login form automatically, then open the page of the Crypto Miner and then click on the "Activate" button.

The login: WORKS

Going to the Miner page: WORKS

Clicking the button: ...
First of all, the whole mine side is in a iframe, which already causes enough headaches and which is probably also the main problem. But then the button doesn't even have an xpath or an id. I tried it via find_element_by_link_text, ...class_name, about ...tag_name, and on many more ways. Nothing. And I guess I'm obviously too stupid to say that with the iframe. Someone could give me a thought impetus or even send me the (perhaps not even so complicated) solution. You can find my code below.

Greetings

DonaldBug13


# Don't click the mining button manually, otherwise you'll have to wait four hours.
# The account and passwaord were just created for this script.

import selenium
import time
from selenium.webdriver.common.keys import Keys

account = 'xxxxx'
pwd = 'xxxxxx'

driver = selenium.webdriver.Chrome('/chromedriver_linux64/chromedriver')  # custimize this path to your own
driver.get('https://app.stormgain.com')
driver.maximize_window()
time.sleep(2)
login_button = driver.find_element_by_link_text('Sign in')
login_button.click()
username = driver.find_element_by_id('email')
username.send_keys(f'{account}')
password = driver.find_element_by_id('password')
password.send_keys(f'{pwd}', Keys.RETURN)
time.sleep(3)
find_miner = driver.find_element_by_link_text('Miner')
find_miner.click()
time.sleep(3)
# Problem 1: switch to iframe
# Problem 2: find the mining button and click
time.sleep(3)
driver.quit()
You can usually switch to iframe by this command.
driver.switch_to.frame(0)