Questions tagged [getattribute]
369 questions
                    
                    566
                    
            votes
                
                8 answers
            
        Difference between __getattr__ and __getattribute__
I am trying to understand when to define __getattr__ or __getattribute__.  The python documentation mentions __getattribute__ applies to new-style classes. What are new-style classes?
         
    
    
        Yarin
        
- 173,523
- 149
- 402
- 512
                    269
                    
            votes
                
                4 answers
            
        Understanding the difference between __getattr__ and __getattribute__
I am trying to understand the difference between __getattr__ and __getattribute__, however, I am failing at it.
The answer to the Stack Overflow question Difference between __getattr__ vs __getattribute__ says:
__getattribute__ is invoked before…
         
    
    
        user225312
        
- 126,773
- 69
- 172
- 181
                    132
                    
            votes
                
                3 answers
            
        How to get an attribute of an element from Selenium
I'm working with Selenium in Python. I would like to get the .val() of a 
         
    
    
        Richard
        
- 62,943
- 126
- 334
- 542
                    19
                    
            votes
                
                3 answers
            
        How to get the value of an attribute in Javascript
I have this input line which I am trying to extract the text of the value attribute:
    
The function getAttribute("class") works…
         
    
    
        Tamara Caligari
        
- 479
- 3
- 12
- 28
                    18
                    
            votes
                
                2 answers
            
        Use cases for property vs. descriptor vs. __getattribute__
The question refers to which one is preferable to be used in which use case, not about the technical background.
In python, you can control the access of attributes via a property, a descriptor, or magic methods. Which one is most pythonic in which…
         
    
    
        Iodnas
        
- 3,414
- 24
- 26
                    14
                    
            votes
                
                4 answers
            
        Using __getattribute__ or __getattr__ to call methods in Python
I am trying to create a subclass which acts as a list of custom classes. However, I want the list to inherit the methods and attributes of the parent class and return a sum of the quantities of each item. I am attempting to do this using the…
         
    
    
        AJ Medford
        
- 323
- 1
- 2
- 10
                    13
                    
            votes
                
                2 answers
            
        python: cooperative supercall of __getattr__
I'm working with somethign similar to this code:
class BaseClass(object):
    def __getattr__(self, attr):
        return lambda:'1'
class SubClass(BaseClass):
    def foo(self):
        suffix = '2'
        return super(SubClass, self).foo() +…
         
    
    
        bukzor
        
- 37,539
- 11
- 77
- 111
                    13
                    
            votes
                
                5 answers
            
        Finding if element is visible (JavaScript )
I have a javascript function that tries to determine whether a div is visible and does various processes with that variable. I am successfully able to swap an elements visibility by changing it's display between none and block; but I cannot store…
         
    
    
        Devon Bernard
        
- 2,250
- 5
- 19
- 32
                    10
                    
            votes
                
                2 answers
            
        To use getAttribute(), or not to use getAttribute(): that is the question
Possible Duplicate:
JavaScript setAttribute vs .attribute=
javascript dom, how to handle "special properties" as versus attributes? 
Many times, in forums or places such as Usenet I have been told by some (when criticizing my code) that instead of…
        user912695
                    9
                    
            votes
                
                1 answer
            
        Difference between .getAttribute and dataset in JS
I have been using .getAttribute and today found out about .dataset, so i was wondering what the differences are and when should each be used.
So here is an example. Let's say we have a paragraph:
        some…
 
    
    
        LuisBento
        
- 678
- 9
- 16
                    9
                    
            votes
                
                5 answers
            
        Selenium getText
I want to getText() using By.id or By.cssSelector.
I managed to solve my problem by doing getAttribute("value"), but I don't understand why getText() doesn't work like I expect it, and I might need it so all help is appreciated.
Here is the Java…
         
    
    
        Lpgfmk
        
- 391
- 1
- 4
- 17
                    9
                    
            votes
                
                1 answer
            
        custom attribute works only with element.getAttribute("attribute") but not "element.attribute"
I have just noticed, that if I give a custom attribute to an html element, for example:
then i can retrieve it like…
         
    
    
        Isti115
        
- 2,418
- 3
- 29
- 35
                    8
                    
            votes
                
                5 answers
            
        getAttribute("value") doesn't work with driver 91.0.4472.19 and Chrome 91.0.4472.77
After Chrome and driver update to 91th version I found the VBA macro with driver 91.0.4472.19 (win32) become return empty string ("") from input tag 'value' attribute:
Dim ch As SeleniumWrapper.WebDriver
Dim el As WebElement
' some code here…
         
    
    
        Viktor Tamanov
        
- 81
- 2
                    7
                    
            votes
                
                5 answers
            
        How to retrieve the value of the attribute aria-label from element found using xpath as per the html using Selenium
I have the following HTML span:
I also have a webElement representing the button containing this…
         
    
    
        ben
        
- 1,064
- 3
- 15
- 29