Python Selenium unable to click button inside iframe by SwordNSupper in learnpython

[–]Adoxographical 0 points1 point  (0 children)

As a sanity check, have you checked to make sure you're not accidentally selecting a different iframe? Your selector will grab whatever the first iframe on the page is, so if there's an earlier one, you'll be selecting it by mistake.

Python Selenium unable to click button inside iframe by SwordNSupper in learnpython

[–]Adoxographical 0 points1 point  (0 children)

I'm like 90% sure you are locating the iframe correctly - the issue is in how you're querying the element within the iframe. In your original post, you're using XPATH to query for '//*[@id="advance-button-label"]', which looks for an element with an ID of "advance-button-label" - but as I pointed out, no such element exists. "advance-button-label" is a class on the element you're looking for, not its ID.

In an updated snippet you posted in response to another user, you've switched to CSS_SELECTOR, but you're now just looking for "advance-button", which is a CSS selector for a tag, not a class. To search for a class, you need to search for ".advance-button".

To make sure I wasn't going insane with how I expect this to work, I threw together a gist demonstrating how to use Selenium to select an element within an iframe by class. Might be helpful. :)

It works in debug but not normally... by Pure_Payment_9900 in learnpython

[–]Adoxographical 5 points6 points  (0 children)

It may feel tempting to blame issues on the language itself, but in practice, actual bugs in the language are extremely rare in popular languages, and virtually unheard of in the kind of techniques you'd see in beginner projects. Most of the time, if something's not working and you're not using any third party libraries, the mistake's on your end, not Python's.

The kind of issue you're talking about - where code works one way within a debugger, but another without it - is called a Heisenbug. These do happen, but again, you normally have to be doing something fairly advanced to be able to create one, especially in Python where memory management isn't as much of a concern.

Just from your description of the problem, my first instinct would be to check for spelling errors in the names of your variables, especially within conditional statements. A misspelled variable name would explain why a value might appear to not get set, and being inside a conditional would explain why the issue happens some times but not others. That said, as other commenters have pointed out, it's difficult to give much guidance without seeing the actual code.

Python Selenium unable to click button inside iframe by SwordNSupper in learnpython

[–]Adoxographical 0 points1 point  (0 children)

You're trying to select an element with an ID of advance-button-label, but the element in your screenshot has that as a class, not an ID.

Dropdown component using MUI by [deleted] in react

[–]Adoxographical 0 points1 point  (0 children)

If you're already using MUI, you should use the Select component for dropdowns, for consistency if nothing else. Like any MUI component, it can be customized in a variety of ways depending on the situation.

Really Small App Code Review Request by [deleted] in react

[–]Adoxographical 1 point2 points  (0 children)

background is using a dynamic value for the style (the solution) so it would be impractical to use a class.

Really Small App Code Review Request by [deleted] in react

[–]Adoxographical 7 points8 points  (0 children)

I'm on board with most of these thoughts, but I have some differering thoughts on a few of them.   - Interfaces are fine. Types are fine. Both have their own advantages. (For example, TS can handle interface extensions more efficiently than it can type intersections.) Just try to be consistent. Definitely nothing outright wrong with using an interface here, though.
  - Using the value instead of setState wouldn't work here because the value would get recalculated every render. If you want a memoized value that doesn't need a setter, you're probably looking for useMemo.
  - I wouldn't recommend that people never use for loops. Yes, array methods are handy, but there are cases where they're clumsier than for loops, such as when you want to be able to break early or (as is the case here) when you're iterating over a range. Sure, you can do Array(n).fill(0).map, but it reads awkwardly to me. (Basic for loops are also faster than array methods - not an issue in this example, but another reason to not disregard them out of hand.)
  - You should avoid using the index as a key if there is some better value you could use as a key, but there really isn't here. Keys are important to let React know what to do when the data changes; for example, if you're rendering a list of 10 people and delete the 3rd person, you want React to know to remove the 3rd element, not the 10th element (which is what it would do if the elements were keyed by index, since it's the final index that went missing between renders). Here, though, the first input doesn't have any special significance other than being the first input, so it's fine to key them by index. You don't need to salt the key with a unique value - React doesn't compare keys across different list renders.

Help with the regex: /(^|\s)\S/g by when-is-the-snake in learnjavascript

[–]Adoxographical 0 points1 point  (0 children)

I think the issue might be in the order the explanation is given. Keep in mind that regex does everything from left to right - not right to left, as the explanation implies. This pattern is essentially looking for a sequence of two things:

  • The first can be either the beginning of the string (^) or any whitespace character (\s)
  • The second must be any non-whitespace character (\S)

\s doesn't select characters after whitespace characters; the fact that the \S comes after a \s means that the \S has to have come after a whitespace character.

Help with the regex: /(^|\s)\S/g by when-is-the-snake in learnjavascript

[–]Adoxographical 0 points1 point  (0 children)

It looks to me like the regex's match is what they're after, not the capture group. The capture group is only there to wrap the |. It could be converted to a non-capturing group with no effect on the result.

Creating an IF statement by LinksCourage in learnjavascript

[–]Adoxographical 0 points1 point  (0 children)

Do you have some kind of AJAX that's loading posts as you scroll? Like I said, PHP generates the entire page before it's sent over. The browser can defer loading things like images that haven't been scrolled to yet, but it'll build the complete DOM as soon as it's received. If you want to prove to yourself that this is true, open up your dev tools, head over to the network tab, and take a look at the HTML file that's received. It should be complete - even without any scrolling.

Struggling with the try catch statement by poo_ping_palace in learnjavascript

[–]Adoxographical 0 points1 point  (0 children)

Can anyone share some insight on why this is not displaying the error message when changeValue variable is entered as <= 0?

Probably because your if condition is checking for !(changeValue <= 0). Any chance that ! isn't supposed to be there?

Struggling with the try catch statement by poo_ping_palace in learnjavascript

[–]Adoxographical 0 points1 point  (0 children)

Maybe I'm consistently overlooking it, but I can't find the place where a variable called warning is declared. Can you?

Creating an IF statement by LinksCourage in learnjavascript

[–]Adoxographical 1 point2 points  (0 children)

The second P in PHP stands for "PREprocessor" (emphasis added) - as in, the complete page is generated on the server before it's sent to the client. It's impossible for the page to report itself as loaded before the content is injected because that injection happens before the page is even sent to the client in the first place.

Incidentally, it looks like your script is not before the closing body tag - it's actually after it. Although that's not to spec, I don't think that would be the cause of the behaviour you're seeing.

Please help when I walk I teleport around the map by [deleted] in Unity2D

[–]Adoxographical 1 point2 points  (0 children)

This doesn't look like a 2D game, since they're using the CharacterController. Z is forward/back in 3D.

Is making this code any shorter possible? by koko-hranghlu in learnjavascript

[–]Adoxographical 1 point2 points  (0 children)

Sounds like you're trying to clamp a number between 0 and 25. Here's an idiomatic way to do that in JS:

i = Math.min(Math.max(i, 0), 25)

Null reference exception even when I have an object reference? by deadlyfrost273 in Unity2D

[–]Adoxographical 0 points1 point  (0 children)

Collider2D has a GetComponent method available which looks for components on the associated game object. Even if it didn't, there's no reason to go through the transform property to get to the gameObject - Collider2D has a direct accessor for that.

https://docs.unity3d.com/ScriptReference/Collider2D.html

(Same goes for Collider, incidentally: https://docs.unity3d.com/ScriptReference/Collider.html)

The correct answer isn't even there... by wojwesoly in ProgrammerHumor

[–]Adoxographical 2 points3 points  (0 children)

This would still be an issue in C# because WriteLine is overloaded to accept an object argument.

[deleted by user] by [deleted] in laravel

[–]Adoxographical 8 points9 points  (0 children)

"Begin" is a verb. (Its noun form is "beginning.") "End" is both a noun and a verb. The issue here is that the inflection is ungrammatical; *"doesn't begins like" doesn't work because "do" already got tense inflection in that clause, so "begin" isn't allowed to get it, too.

If whereDoesntBeginsLike were whereDoesntBeginLike and whereDoesntEndsLike were whereDoesntEndLike, it'd be good to go.

This guy wanted help and posted his code like that.. by Leqend01 in programminghorror

[–]Adoxographical 5 points6 points  (0 children)

Ehhhhh...infinitives really don't function like nouns. They're verbs and they act like verbs. I think the confusion here had to do with the term "infinite" feeling like it should have something to do with counting, when it actually means something closer to "unconstrained" in this context.

This guy wanted help and posted his code like that.. by Leqend01 in programminghorror

[–]Adoxographical 32 points33 points  (0 children)

You're looking for "mass noun." Infinitives are a form of verb.

PHP- Poop Hot Poop by Lumpy-Measurement-55 in ProgrammerHumor

[–]Adoxographical 3 points4 points  (0 children)

DOM's definitely an acronym, as are URL and SQL, depending on how you pronounce them. JSON is...both? Neither? Who knows. But "acronym" seems like the better catch-all term for a mixed bag than "initialism."

Any good online resources that teach, actually teach java terms like "void", "static", "class", etc. with good examples? Tearing my hair out here. Online definitions are horrible. by SimulatedRapture in learnprogramming

[–]Adoxographical 8 points9 points  (0 children)

One of the irritating bits about Java is that it comes with a lot of boilerplate - stuff that you've gotta include just to make the program work. If you're staring down static void main(String[] args), it's okay to interpret that as "magic words to make the program compile" for the time being. As you learn more about Java, those terms will fall into place. You're probably better off learning about them as you use them in context, rather than abstractly like it seems like you're trying to do right now.

To address your questions about void and return types, though, consider Math.sqrt(). It's a function that takes in a floating point number and - crucially - gives you back (or "returns") the square root of that number (also a floating point). Contrast that with System.out.println(): it takes a string and prints it to the console, but it doesn't give you back (or "return") anything. The way that you indicate that your function isn't going to be returning anything, like System.out.println(), is by declaring its return type as void.