Search code examples
htmlpython-3.xseleniumwebdriver

Changing div _rmc values


In my div TAG there is a _rmc value. well inside there is a variable called PreferValueIndex i need to change that value to one of the options (1, -1, -9999) 1 = true , -1 false , -9999 block. i need some help on how to do this . and an explanation about what is _rmc means.

using:

import logging
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

Solution

  • You can change the attribute like this :

    driver.execute_script("arguments[0].setAttribute('_rmc','your new value')", element)
    

    Where element is the webelement (the div )

    Update :

    value = "relative; background-color: rgb(215, 14, 82); cursor: url(""Images/cant.cur"")"
    driver.execute_script(f"arguments[0].setAttribute('_rmc','{value}')", element)